Usually air is an insulator. It does not allow charges to flow through it even when two charged bodies come close to each other.
But if the bodies have extremely high charges, the electric field around them will also be very high.
Due to this, the electrons from the outermost orbit of the air molecules come out and positive and negative ions are created. This is known as the ionization of air.
After ionization, air acts as a conductor and provides a path for the flow of charge from one body into another.
This results in a flash of light and the phenomenon is known as sparking.
When this sparking occurs between charged clouds, it is called lightning.