The Earth's atmosphere is full of energy. This energy drives the world's weather, and shapes the climates. Over the longer term, changes to this energy can bring about variations in climate. At the planetary scale, changes that are currently taking place as a result of man-made greenhouse gas emissions may be causing global warming.
All bodies emit energy in the form of electromagnetic radiation. Light is a form of electromagnetic radiation. So are infrared heat, ultraviolet radiation, radio waves and x-rays. The type of radiation emitted by a body depends upon its temperature. Hotter objects release more energetic radiation. The Sun, for example, emits visible light and ultraviolet energy. The Earth and its atmosphere, being much cooler, emit radiation in the infrared part of the spectrum. Living things, including humans, also emit radiation in the infrared part of the spectrum. This energy is known as heat energy.
When the Earth receives (light and ultraviolet) energy from the Sun, much of it is absorbed either by the atmosphere or at the Earth's surface. The Earth re-radiates (infrared) energy back to space, such that there is a balance between incoming energy from the Sun and outgoing energy from the Earth. This global energy balance maintains a fairly even temperature at the surface of the Earth.
Of course, there are differences in temperature between different parts of the world, due to the different amounts of received sunlight. Regions nearer the equator receive much more energy than regions nearer the poles, and are consequently much warmer. These differences in surface temperature create flows of energy within the Earth's atmosphere itself, which are the driving forces behind the world's weather.
Gases and aerosols in the Earth's atmosphere affect the transfer of energy to and from the planet. The greenhouse gases absorb a lot of infrared energy that is trying to escape to space, and heat up the planet. For this reason, the Earth is on average 33C warmer than the moon, which is a similar distance from the Sun. This natural warming process is called the greenhouse effect. Gases and aerosols in the atmosphere scatter incoming sunlight in all directions. Blue light is scattered the most, which is why the sky appears blue during the daytime. Different parts of the Earth's surface also affect the transfer of energy. Polar regions covered in white snow and ice are much more reflective than darker areas of the planet, and proportionally less sunlight is absorbed there.