Thunder is the release of heat energy caused by huge differences in the electrical charge of a cumulonimbus cloud. This release of energy causes shock waves that we can see and hear. What we see is lightening, then seconds later we can hear thunder. Light travels faster than sound so we always will hear the lightening before the thunder.
The energy that is released in the form of lightening occurs when a cloud changes from being positively charged to negatively charged due to charge differences in the atmosphere. The earth tends to be more negatively charged that the air.
If you want to know how far away the storm is, simply count (using one one thousand, two one thousand etc.) from the time you see the lightening until you hear the thunder. For each one one thousand you count, the storm is 0.3 km (.2 miles) away. For example, if you counted to three one thousand, the storm is three times 0.3 km or 0.9 km away ( three times 0.2 miles=0.6 miles). If there is almost no time between the lightening and thunder, the storm is overhead.
Thunderstorms are caused by a strong uplifting current of air caused by the heating of air because of warm earth surface, a cold front coming in, or large differences in the water to land temperatures.The first two are common causes on the West Coast. Here, we seldom have thunderstorms because the difference between land and water temperatures do not vary much. On average we have about 5 thunderstorms per year, compared to more than 90 storms per year they have in Florida where the water to land temperatureis very different!
There are three stages in the formation of a thunderstorm:
by Donna Hill B.Sc. B.Ed. 1998
source: Golden Guide to Weather