I'll return to that question later. Every minute, every hour, every day the solar wind showers the Earth with protons and electrons which enter the Earth's magnetic field at a rate of 37,000 miles per hour. Once they enter the magnetosphere the electrons and protons are separated which creates an electrical potential of at least 20,000 volts. During intense solar activity the potential can increase to 150,000 volts. Because the electrons have a negative charge, they spiral along the magnetic field lines downward where they get bounced around with oxygen and nitrogen.
Energy is absorbed when an electron is captured by an atom.
When an electron escapes from an atom the energy is released in the form of light. The color of the light depends on the element. For example, atomic oxygen will emit the color green and when extremely energetic rarefied oxygen will emit the color red. Nitrogen will typically emit red hues and rarely violets and blues depending on the energy level. Such light is the glow that we know as aurora.