Since heat makes things expand, like a marshmallow in a microwave, the air expands when the lightning heats it. Because the rate of expansion is so fast, the air actually vibrates, causing waves. These waves are the sound waves that we hear as sound, or thunder.
For example: let's say that you see a flash of lightning and then begin to count how many seconds before you hear the thunder. If you count 15 seconds this means that the lightning struck about 3 miles from you (divide 15 seconds by 5 seconds to figure the stroke was 3 miles away).
When Does Lightning Occur and Why?
The Cloud to Ground Striking Process
Link to Northern Michigan University
Amber Wozniak: awozniak@nmu.edu