Lightning is a massive electrostatic discharge caused by unbalanced electric charge in the atmosphere. Lightning can be either inside clouds (IC), cloud to cloud (CC) or cloud to ground (CG) and is accompanied by the loud sound of thunder. Because the speed of sound in air (~340 m/s) is so much slower than the speed of light (300,000,000 m/s) from the lightning flash the distance to a lightning strike can be closely approximated by dividing the flash-thunder interval, T (sec) by 3–T(sec)/3 = km distance or T(sec)/5 = mile distance. Thunder often lasts several seconds because the sounds from different parts of the lightning strike arrive at different times.
A typical cloud to ground lightning strike is often over 5-6 km (3-4 mi) long but may be many kilometers longer. A typical thunderstorm may have three or more strikes per minute at its peak. Lightning is usually associated with and produced by cumulonimbus clouds which may reach up to 15 km high (10 mi) high and often have a base 5-6 km (3-4 mi) above the ground. The sun heats the earth and water causing massive up-drafts of warm moisture-filled air to rise like a giant hot air balloon that go through different temperature zones and electric fields typical of a thunderstorm formation. Once the moisture in the air cools and condenses into rain droplets or ice crystals it falls in massive turbulent down drafts typical of rain storms. The temperature of the moisture filled air typically falls about 6° C (11° F) for each 1,000 metres (3,300 ft) of higher elevations causing much of the water vapor to freeze into ice crystals or super cooled water droplets at higher elevations.
As the ice crystals, graupel or water droplet laden masses of air rise or fall they tend to either accumulate or get rid of electrons depending on the type of ice or water particles in the air and the electric fields and temperatures they are rising or falling through. The rising and falling particles in the air acts like a massive Van de Graaf generator belt that is used to separate the negatively charge electrons and positively charged molecules missing electrons. These accumulations of charge of different signs generate large powerful electric fields in the clouds and between the clouds and ground much like what would occur in a massive parallel plate capacitor. Strong electric fields between clouds with too many or not enough electrons or clouds and the ground accelerate these electrons towards areas deficient in electrons Via Lightning