History
Pietervan Musschenbroek and his assistants Allmand and Cunaeus invented thecapacitor in 1745 but it was nothing like the modern capacitor. It was called the Leyden Jar. This was a jar. A part of itwas coated with conductive metal inside and out. a conductive wire wasattached to the inside metal coating and came out the jar top through acork. This was one of the first devices to charge electricity.
Over the years, new materials and techniques have been refined to give capacitors better performance and they've beengreatly reduced in size. Instead of a glass jar, we use lots ofdifferent insulators to give us different results(see types). Biggerplates will be able to store a bigger charge. So today we put theplates either side of a flexible insulator, mostly paper, and roll itto make it smaller.
How it worksCapacitors store charge like a rechargeable battery.
Fig.1Fig.2

Circle with an X: Lamp
Box with + and - in: Battery
Top box: Capacitor
Thepictures aren't official component symbols, just diagrams. In fig.1 thecapacitor has gained negatively charged electrons from the battery andthat side (plate) of the capacitor wants to push them out into theother side of the capacitor. When the battery is taken away andreplaced with a conductor like a connecting piece of wire, thenegatively charged electrons flow through the lamp, light it and intothe other plate. When the negative electrons are equal on either side(fig.2) the lamp with fade and stop working.
How it's used
Capacitorscan be put in series and parallel to give you different values. Theformula is exactly the same as resistors except the opposite.
The formula to connect capacitors in series is C1/C2 (capacitor one divided by capacitor 2).
The formula to connect them in parallel is C1+C2 (capacitor one plus capacitor 2).
Capacitorsare polarised. So if you connect them up the wrong way they probablywill explode with enough charge. Experimenting is always the best wayto learn ;)
Types
The capacitor on the right is an electrolytic capacitor. It is cheap, and easily available.
Other types are: