A bolt of lightning heats up a long thin column of air to umpteen thousand degrees Celsius. This causes it to expand, and the expansion is so rapid that it sends out a shockwave which is perceived as sound. The thunder travels away from the point where the lighning strikes, so it is possible to determine the distance by counting the time between the flash of lightning and the thunder (1 mile is about 4.7 seconds). The rumble sound of the thunder is caused by the noise bouncing around buildings and other obstacles, so the initial bang of the thunder is followed by a flow of echoes.