Static electricity is commonly produced when insulating materials rub together. When fur is rubbed against an ebonite rod, the fur becomes negatively charged and the rod becomes positively charged. Electrons are transferred from one material to the rod to the fur, resulting in an electric field. Some materials under some circumstance can transfer enough charge to cause a spark to discharge. When this happens the air, usually an insulator, becomes conducting.
During periods of high wind air can rub against clouds and water droplets as they freeze and fall from higher altitudes, and water as it evaporates. These can act to transfer charge in the same way as when fur rubs against ebonite. Charge builds up on a cloud and the ground as shown below.
Eventually the field can become enough to cause an electrical discharge from the cloud to the ground, breaking down the electrical resistance of the air. In dry air, the field needs to be aboutbut if the build up of static electricity in this way is accompanied by rain, discharge can happen for fields of much lower strength.
The electrons are much lighter and more mobile than the positively charged atoms, so find it easier to move. Discharge usually originates in the cloud therefore and travels towards the ground but this is not visible. When the electrons meet the atoms to both are neutralised and light is emitted. This appears to start near the ground and travels upwards, though the charge that causes it is actually the electrons, moving down.