Most lightning occurs within clouds.
Turbulence within a cloud during a storm cause ice crystals to create an area of positively charged ions near the top of the cloud and a region of negatively charged electrons near the bottom of the cloud. Since the negative charges in the cloud repel negative charges on the ground, it causes the ground to become positively charged. when the amount of charges become sufficient, The electrons stream from the cloud and the positive ions stream from the ground. When they meets, a powerful surge of current shoots backward up the path, causing the lightning.