Energy in the upper layer of the atmosphere resulting in auroras
The ionosphere is the upper layer of the Earth’s atmosphere. The atmosphere is partly ionised by solar UV-light, and such ionisation can persist at high altitude: the ionosphere starts at about 80 km altitude and reaches up to more than 1000 km.
The ionosphere and the magnetosphere are connected to each other by the geomagnetic field lines. Because these behave as very good electrical conductors, electromagnetic energy can be transported from the magnetosphere down into the ionosphere through electric currents, the so-called Birkeland currents.
The aurora is the most spectacular manifestation of this energy transfer. The physical mechanisms behind the aurora are still largely unknown. )
We know that auroras are produced by magnetospheric electrons that follow the magnetic field lines and that are accelerated by electric fields up to energies of several thousands of volts.
The acceleration mechanism itself, however, remains somewhat of a mystery. When those accelerated electrons hit atoms and molecules in the tenuous upper atmosphere at 90-120 km altitude, they excite or ionise them. As a consequence, those atoms and molecules emit light of specific colours.