Electrostatic lines of force wich a between the earth and a cloud are always trying to pull the earth and cloud together
Basically a cloud wich is water, water holds 50 times more electricity than air
So as water evaporates these electrostatic lines of force become tighter, then the electricity has nowhere to go because it cant all go in air because air holds very little electricity...
So what happens is you get a massive blast wich is lightning
I left out some of the deeperstuff