For various reasons, air can begin to move upwards in the atmosphere and if it is cold enough at altitude, there is a chance of thunder. The important ingredients are upwinds, cloud drops and ice particles. 

This is how it works with summer thunder

In summer, thunderclouds are most often formed by the sun's rays radiating heat to the air closest to the ground and causing it to float upwards like a balloon. On the way up, the air bubble expands, gets colder and its water vapor turns into small drops of water.

A cloud is formed and grows in height as long as the air package from the ground is warmer than the surrounding air in height. If the conditions are really good, the cloud top still rises up to the tropopause, which during the summer is at an altitude of about a mile. At that height it can be 50 degrees cold so the cloud top consists entirely of ice particles that flow out in the direction of the wind and make the cloud look like an anvil. 

Inside a thundercloud, it is both strong up and down. Cloud droplets and ice particles go wild, up and down through the cloud collide, form larger lumps and break apart. The cloud is charged like a battery by negative charges for some reason sticking to the large heavier droplets at the bottom of the cloud while the positive ones follow with the smaller ice particles to the top of the cloud.

After a while, the large amount of negative charge in the bottom of the cloud attracts positive charge on the ground under the cloud. When the voltage between ground and cloud base becomes large enough, the lightning discharge occurs. But most discharges occur within the cloud itself or between other clouds.

The flash always strikes in the same place

Before the main discharge can take place, a road, a lightning channel, must be built. This is done by charges "feeling" through the air in stages of about 30 meters through so-called shock ionization. Since the charges do not know in advance which path will be the easiest, the jump takes place in several different directions, which makes the lightning look like an upturned tree with several "branches" closest to the cloud bottom.

When the pre-charges have found the best way down to the ground, the main discharges take place, an average of three. The lightning always strikes in the same place.

This is how you avoid being hit

The lightning's more than 30,000 degree heat ignites the air in its path and causes the air in the lightning channel to expand rapidly. We see the flash first because it travels at about 300,000,000 m / s. The sound with its just over 300 m / s comes much later. Therefore, you can estimate how far away the thunder is by counting the number of seconds between lightning and thunder, since three seconds is roughly equivalent to one kilometer. 

Thunder is a violent natural phenomenon that on average kills one Swede per year, lots of tamboskap and starts house and forest fires. 

If it thunders, avoid being or standing near the highest point of a flat surface. The most accident-prone activities are golf, sailing and football.