Energy is constantly entering and leaving the Earth.
It enters in the form of sunlight, and it leaves in the form of infrared radiation, a sort of light given off by most objects with Earth-like temperatures, like you, or me, or the ground, or the atmosphere. The hotter an object is, the more infrared radiation it gives off.
If an object is giving off less energy than it's absorbing, it will generally heat up until the amount of energy leaving the object is the same as the amount entering. This balance is believed to determine the Earth's climate.
While this picture is true on average, it need not be true uniformly across the face of a planet. Areas where the Earth mostly gains energy (e.g., the sunny tropics) can be balanced by areas where the Earth mostly loses it (e.g., the poles). You can see this in the visualization below, which plots the movement of energy in and out of the top of the Earth's atmosphere as observed by NASA's CERES instruments. The "net flow of energy" is simply the difference between the amount of sunlight the Earth is absorbing and the amount of radiation it's giving off.
To see different parts of the Earth, change the latitude/longitude above (this works quickest in Firefox, in which you can also drag the Earth). To zoom in, use your browser's zoom functions. The units for flows of energy is watts per meter squared (W/m2). For scale, a watt is roughly equivalent to lifting four pounds about an arm's length up every second, and a meter squared is about the size of a square of sidewalk. So, if you're getting 50 W/m2 of energy, it's like each sidewalk square worth of surface is benchpressing 200 pounds a second. It's an energetic world!
The reason there's so much concern about greenhouse gases like carbon dioxide is that these gases can inhibit the amount of light leaving the Earth, meaning the Earth has to be that much warmer to give off the same amount of light as before. The difficulty of the science lies in understanding just how much warmer it has to get to compensate – will it be a little? A lot?