Thunder is the crash and rumble associated with lightning. It is caused by the explosive expansion and contraction of air heated by the stroke of lightning. This results in sound waves that can be heard easily six to seven miles (9.7 to 11.3 kilometers) away. Occasionally such rumbles can be heard as far away as 20 miles (32.2 kilometers). The sound of great claps of thunder is produced when intense heat and the ionizing effect of repeated lightning occurs in a previously heated air path. This creates a Shockwave that moves at the speed of sound.
Article source http://www.scribd.com/doc/33786529/The-Handy-Weather-Answer-Book