The aurorae are caused by particles in the solar wind brushing past the Earth's magnetic field which captures some of them and sends them spiralling down through the atmosphere.
Gases (like nitrogen and oxygen) in the Earth's atmosphere light up when particles from the solar wind hit them.