Many types of energy stream constantly from the sun. Some of this is very intense high frequence radiation such as gamma rays and X-rays. This radiation is so powerful that it is ionizing radiation. That is, it strips the electrons off of atoms that it hits. When these rays hit the upper atmosphere, they ionize the gasses in the air. For example, they turn oxygen gas (02) into ionized oxygen and ozone (03). As the gasses release the excess energy and return their to their ordinary state, they discharge the energy again, but at a lower frequency. Some of those discharges are in various colors of the visible spectrum. So, high in the air, we see plays of colored light. They are seen most clearly with a backdrop of dark sky, so we see them near the North Pole (Aurora Borealis) and South Pole (Aurora Australis).
I've never seen the Aurora Borealis, but I would love to.