From Academic Kids
Thunder is the sound of the shockwave caused when lightning instantly heats the air around it to up to 30 000 °C (54 000 °F). That super-heated air expands rapidly, then contracts as it cools. The rapid expansion/contraction generates sound waves, making the sound that is called "thunder."
Because sound and light travel at different speeds through the atmosphere, one can time the interval between them to roughly estimate how far away the bolt of lighting is. The speed of sound in air is approximately 340 m/s (761 mph), while the speed of light is so fast that the lightning is seen only a few microseconds after the event, so the lightning is approximately one kilometre distant for every 3 second interval (one mile for every 5 seconds).