What are the three main flows of electricity involved during the lightning phenomenon?
A cloud is usually a large turbulent body, and there is a lot of shuffling going on inside. Within the same cloud, there are pockets of built-up charges such that at different places, there are different amounts of positive or negative charges. When there is a sufficient build-up: when one region has a large enough positive charge, and another has a large enough negative charge, there is a massive spark - which is similar to a static electrical discharge. This phenomenon is known as lightning. Most of the lightning phenomena happen within a cloud, but sometimes it happens between the cloud and the ground.
When one cloud comes closer to another, sometimes there is a build up of charge due to induction. Say, for example, one cloud has a negative charge at its end - which is closer to a different cloud body. The parts closer to the second cloud acquire a positive charge due to induction whereas the parts away from the first cloud get a positive charge.
Lightning between a cloud and the ground:
Although this may be common in human experience, this does not happen as frequently as the lightning within a cloud. For this to happen, there is a build up of positive charge on the ground beneath a cloud. These positive charges concentrate around anything that sticks up - like tall trees, lightning conductors, and even people! If the lower parts of a cloud work up an excess negative charge, the positive charge from the ground connects with the negative charge from the clouds and a spark of lightning strikes.