Wikipedia
The Earth receives an enormous amount of solar radiation. Just above the atmosphere, the solar power flux density averages about 1366 watts per square meter, or 1.740×1017 W over the entire Earth. This figure vastly exceeds the power generated by human activities.
The solar power hitting Earth is balanced over time by a roughly equal amount of power radiating from the Earth (as the amount of energy from the Sun that is stored is small). Almost all radiation leaving the Earth takes two forms: reflected solar radiation and thermal blackbody radiation.
Solar radiation at top of atmosphere and at Earth's surface.
Reflected solar radiation accounts for 30% of the Earth's total radiation: on average, 6% of the incoming solar radiation is reflected by the atmosphere, 20% is reflected by clouds, and 4% is reflected by the surface.
The remaining 70% of the incoming solar radiation is absorbed: 16% by the atmosphere (including the almost complete absorption of shortwave ultraviolet over most areas by the stratospheric ozone layer); 3% by clouds; and 51% by the land and oceans. This absorbed energy heats the atmosphere, oceans, land and powers life on the planet.
Like the Sun, the Earth is a thermal blackbody radiator. So because the Earth's surface is much cooler than the Sun (287 K vs 5780 K), Wien's displacement law dictates that Earth must radiate its thermal energy at much longer wavelengths than the Sun. While the Sun's radiation peaks at a visible wavelength of 500 nanometers, Earth's radiation peak is in the longwave (far) infrared at about 10 micrometres.
Atmospheric absorption of various wavelengths of electromagnetic radiation (measured along sea level).
The Earth's atmosphere is largely transparent at visible and near-infrared wavelengths, but not at 10 micrometres. Only about 6% of the Earth's total radiation to space is direct thermal radiation from the surface. The atmosphere absorbs 71% of the surface thermal radiation before it can escape. The atmosphere itself behaves as a blackbody radiator in the far infrared, so it re-radiates this energy.
The Earth's atmosphere and clouds therefore account for 91.4% of its longwave infrared radiation and 64% of Earth's total emissions at all wavelengths. The atmosphere and clouds get this energy from the solar energy they directly absorb; thermal radiation from the surface; and from heat brought up by convection and the condensation of water vapor.
Because the atmosphere is such a good absorber of longwave infrared, it effectively forms a one-way blanket over Earth's surface. Visible and near-visible radiation from the Sun easily gets through, but thermal radiation from the surface can't easily get back out. In response, Earth's surface warms up. The power of the surface radiation increases by the Stefan-Boltzmann law until it (over time) compensates for the atmospheric absorption.
The surface of the Earth is in constant flux with daily, yearly, and ages long cycles and trends in temperature and other variables from a variety of causes.
The result of the greenhouse effect is that average surface temperatures are considerably higher than they would otherwise be if the Earth's surface temperature were determined solely by the albedo and blackbody properties of the surface.
It is commonplace for simplistic descriptions of the "greenhouse" effect to assert that the same mechanism warms greenhouses, but this is an incorrect oversimplification.