This is a very simple explanation of the greenhouse effect with a suitably simple diagram. An explanation of the warming effect of greenhouse gases follows. There follows a slice of history about the origins of the greenhouse effect and the part played in it by John Tyndall.
The Greenhouse Effect
The Earth's atmosphere is moderately transparent in the visible part of the spectrum and the majority of the solar radiation can pass through the atmosphere without being absorbed and is absorbed by the surface which is thus warmed. On the other hand, minor atmospheric constituents, the greenhouse gases, of which water vapor is the most important, absorb strongly in the infrared region which is where the Earth's surface emits. The atmosphere is largely opaque to the terrestrial infrared heat radiation.
What happens when the atmosphere absorbs radiation emitted from the surface of the planet? The atmosphere cannot steadily accumulate energy or it would become hotter and hotter. Instead, it emits radiation at the same rate as it absorbs when it has become hot enough to establish radiative equilibrium. The radiation is reemitted in all directions, and a substantial part of it is intercepted and absorbed by the surface. So the surface of the planet is heated not only by direct sunlight but also by infrared radiation emitted by the atmosphere. For this reason the surface of a planet must radiate away more energy than it receives directly from the Sun, and the surface can have a temperature that exceeds the effective temperature of the planet. This is the greenhouse effect in simple outline. The details are far from simple and references to papers are available on subsequent pages.

In the left-hand tank there is a particular concentration of CO2 that assists in the positioning of the overflow. With a constant flow of sunlight into the tank, at equilibrium when the overflow is equal to the incoming sunlight, there is a flow to space of infrared radiation from the planet of equal intensity. Solar energy entering = IR1. This equilibrium occurs when the tank is sufficiently full of energy to cause overflow and the energy in the tank at that stage determines the temperature of the system.
In the right-hand tank the concentration of CO2 has been increased, placing the overflow at a higher level. This has the consequence of making the thermal reservoir, the heated system, warmer. Note that at radiative equilibrium the above equation still stands;
Solar energy entering = IR2 = IR1
There is more energy contained within the system which is then warmer.
The tank analogy can be extended to the extreme case where there are no greenhouse gases present in the atmosphere so that the Earth's surface can radiate energy directly to space without hindrance. This is shown in the next diagram.

Here the 'overflow' is place at the bottom of the tank so that any solar radiation entering has an unhindered escape. Again radiative equilibrium is attained:
Solar radiation entering = IR0 = IR1
In this case the thermal reservoir is empty and the planet would be very cold with a temperature equal to its emission temperature of 255 K.
The Greenhouse Effect & John Tyndall; a bit of history
John Tyndall (1820-1893) conducted experiments at the Royal Institution on the radiative properties of various gases. He discovered the vast differences in the abilities of ‘perfectly colorless and invisible gases and vapours’ to absorb and transmit radiant heat. The ‘elementary gases,’ oxygen, nitrogen, and hydrogen, were almost transparent to radiant heat, while more complex molecules, even in very small quantities, absorb much more strongly than the atmosphere itself.
He identified the importance of atmospheric trace constituents as efficient absorbers of long wave radiation and as important factors in climatic control. Specifically, he established beyond a doubt that the radiative properties of water vapour and carbon dioxide were of importance in explaining meteorological phenomena such as the formation of dew, the energy of the solar spectrum, and possibly the variation of climates over geological time.
He concluded that ‘The solar heat possesses the power of crossing an atmosphere; but, when the heat is absorbed by the planet, it is so changed in quality that the rays emanating from the planet cannot get with the same freedom back into space. Thus the atmosphere admits of the entrance of the solar heat, but checks its exit; and the result is a tendency to accumulate heat at the surface of the planet.’
He recognized that water vapour, among the constituents of the atmosphere, was the strongest absorber of radiant heat and was the most important gas controlling the Earth's surface temperature. He proposed the analogy that ‘The aqueous vapour constitutes a local dam,
by which the temperature at the earth's surface is deepened; the dam, however, finally
overflows, and we give to space all that we receive from the sun.’ He recognized the importance of radiative equilibrium in which the Earth receives energy from the sun and emits the same amount of energy to space so that the system has a long-term balance and a steady, but within limits a very variable climate.
He gave credit to his predecessors Saussure, Fourier, and Pouillet, among others, for the intuition that “the rays from the sun and fixed stars could reach the earth through the atmosphere more easily than the rays emanating from the earth could get back into space.” The experimental verification of this phenomenon was done by Tyndall.
Tyndall’s dam analogy can be exemplified by what happened to the Colorado River. Its flow rate is around 620 cubic metres per second. The building of the Hoover Dam caused the formation of Lake Mead which contains a maximum of 35.2 cubic kilometers of water. That works out at 1.8 years of flow. An equivalent calculation for the atmosphere reveals a thermal reservoir that would be filled by about four months of absorbed sunlight. Additional CO2 would add to this reservoir, just as making the Hoover Dam higher would increase the size of Lake Mead. If the dam should burst, the water flow would be unchanged, but the ‘thermal reservoir’ would be empty. Likewise, a world without greenhouse gases would be very cold.