due to photon excitation, particles in the air gradually grab electrons and gain a charge
when weather turns cold, due to air rising and pressure diminishing, water vapor condenses into droplets
the surface of these droplets grows in x^2 while their volume grows in x^3
which means that the electrical charges of the various stuff in the raindrops increase way more than the ability of the droplets to keep them, so the charges located at their surface escape in the surrounding air as low-temperature plasma, generating a growing magnetic fiels within the storm cloud
this magnetic field manages to self-contain the electrical charge of the cloud, but keeps lowering the internal pressure, so the cloud climbs way higher than freezing temperature of the water droplets
and the droplets newly transformed into ice particles become suddenly much less able to keep electrical charges on their surface
result; after enough energy transfers within the cloud, an irreversibly unstable condition develops where the charge is so high that the air column under the cloud is not insulating anymore
a static electric field develops progressively from could to ground, and once there is contact, a large part of the cloud's charge flows in a few seconds
thunder