Electric sparks tend to appear blue or purple or white in color. Why?
Air is normally a bad conductor of electricity, but with enough voltage it can be converted to plasma, which is a good conductor. In a plasma, the electrons constantly bind to and leave atoms. Each time an electron binds to an atom, it emits the energy in light. As a result, the plasma glows the color of a photon with that energy. There are a few different energy levels that get involved, so the spectrum has a few different peaks. The final color depends on the gas you use. For example, neon looks red or red-orange. Air ends up looking blue, so electricity passing through air makes it glow blue.
The answer is that electrical excitation of air molecules is able to produce lots of excited singly ionised nitrogen ions.
The electronic structure of singly ionised nitrogen has a number of allowed radiative transitions, where the outer excited valence electrons can rearrange themselves into lower energy configurations.
The most prominent turn out to be those transitions corresponding to emitted photons at 443, 445 and 463 nm, and it is these that are responsible for the blue airglow.