Lightning occurs when electricity is released with in the atmosphere. Several things lead up to and cause lightning strikes.
Firstly, water particles are evaporated from the Earth’s surface. As they travel further up into the atmosphere, they accumulate into clouds. As water molecules rise through the clouds, electrons are knocked off and gather at the lower parts of the cloud systems. The top parts of the clouds are now positively charged with positive ions. These are atoms missing 1 or more of their electrons. This separation creates an electric field within the clouds, again with a positive charge at the top and a negative charge at the bottom.
The negative charge at the bottom of the cloud becomes so strong that it pushes the negative charge at the Earth’s surface deeper into the Earth. This gives the surface a strong positive charge. All that is now needed is a path from the clouds to the ground’s surface, which is supplied by the electric field.
This creates an opportunity for the air to become ionised. This means that the electrons and positive ions are further apart than they were before. The ionsed air, called plasma, is much more conductive than it was before as the electrons are now moving more freely.
The ionised air creates a path known as a leader, which is not the actual strike. This is the path that the electric current of the strike will take once the clouds and the Earth are connected. Once this happens, the current flows between the cloud and the ground. This is an attempt by nature to neutralise the separation between the groups of charge. The flash given off by the strike is the result of the enormous amount of heat in the current. A bolt of lightning is hotter than the surface of the Sun.