So far, I have hinted at a slight complication to the simple picture I have presented of how the Earth's temperature is governed by radiation. I noted that the atmosphere emits infrared radiation. It also absorbs infrared radiation. So while it is nearly transparent to solar (visible) radiation, it is partly opaque to infrared radiation.
Think about how that would affect the Earth's temperature. The main source of energy of the Earth's surface (and the air just above it) is the radiation coming down from above. During the day, it gets strong radiation from the sun, and it heats up. More radiation comes in than is emitted back into space. At night, though, only the weak radiation from the atmosphere reaches the Earth, and it cools off because it's still emitting radiation back into space.
Suppose you could increase the amount of radiation emitted by the atmosphere. That would increase the amount of energy reaching the surface of the earth, and the temperature would go up as a result. It turns out that all you have to do to increase the emission of radiation by the atmosphere is increase the concentration of those gases which are capable of emitting radiation. The most common such gases are water vapor and carbon dioxide, although there are a few others. So do you see what's going on? Since the atmosphere's carbon dioxide is increasing, the temperature of the Earth ought to be increasing too. This is the basic explanation of the greenhouse effect and global warming.
It's like having an unheated room with one window and ten light bulbs. The only sources of warmth are the sunlight coming through the window and the ten light bulbs, which are on continuously. If you add another light bulb to make it eleven, the temperature of the room will go up slightly. That's what appears to be happening with carbon dioxide and the Earth.