This question is not really about astronomy, and you can find the answer in any book about weather research. I think the main idea is that air masses develop a large charge through some process we don't fully understand. This probably involves frictional contact between water droplets which leads to charge segregation inside the cloud. When the potential difference between the cloud and the ground exceeds the break-down potential of the atmosphere, a tongue of negatively-charged particles invisibly descends from the cloud to the ground in a path of least resistance until contact with the ground is made within a few seconds. As soon as this happens, a massive flow of electrons travels down the channel in several pulses, to form the lightning bolt. This bolt is a channel perhaps a few centimeters wide, but where frictional energy heats the air to nearly 10,000 degrees. There are thousands of these bolts of lighting going off every minute around the world, and this helps keep the atmosphere at a fixed voltage relative to the ground of about 250 volts or so.
All answers are provided by Dr. Sten Odenwald (Raytheon STX) for the
NASA IMAGE/POETRY project.