Capacitors in some ways are sort of like batteries in the sense that both batteries and capacitors store electric energy, however they work in completely different ways. Everyone knows that batteries have two terminals and inside of them are chemical reactions that help to create electrons on one of the terminals and then absorb electrons on the other terminal. A capacitor however, is a lot simpler than a battery, it is not able to produce new electrons, it can only store them.
Inside capacitors you will find that the terminals are connected to two plates of metal and they are separated by a substance that is non-conducting or dielectric. Capacitors can be made quite easily by taking two pieces of foil and one piece of paper, it won't be a real good one but it still will actually work.
The theory is that the dielectric can be any kind of substance that is non-conductive. Specialized materials are used that will suit the function of the capacitors. Such materials can be mica, ceramic, porcelain, Mylar, Teflon or cellulose. Sometimes air can even be used as a non-conductive material. The dielectric will dictate what kind of a capacitor it is and what it is best suited to be used for. It will depend on the size of the capacitor and the type of dielectric. Some of them are best for high frequency use and others are better for high voltage use. They can be made to serve just about any purpose from very small plastic capacitor in a calculator to a huge capacitor that can power a bus. NASA used glass capacitors to wake up the space shuttle's electric circuitry and to also help in deploying space probes. Other uses are:
Air – Most often used for radio turning circuits.
Mylar– Most often used for timer circuits such as counters, alarms and clocks.
Glass– Often used for high voltage applications.
Ceramic– Often used for high frequency items like antennas, MRI machines and X-ray machines.
Super Capacitor– This powers electric and hybrid cars.
Here is what happens when you connect a capacitor to a battery: