Thunder is created when lightning heats the air around it to extreme temperatures, causing rapid expansion and contraction. This creates sound waves that travel through the atmosphere. The delay between seeing lightning and hearing thunder is due to the fact that light travels much faster than sound. By counting the seconds between the flash and the sound, you can estimate the distance of the storm.