During a thunderstorm, the air currents move upwards and the water droplets move downwards. And this caused the separation of charge due to this vigorous motion.
As a result of this process, the positive charges collect near the upper edge and the negative charges accumulate near the lower edge of the cloud and also near the ground. As the charge gets accumulated, its magnitude becomes very large. Water droplets in the air act as a conductor of this charge.
These charges flow to meet, thus producing strikes of lightning as shown in the figure below.