Why does Earth lose heat mainly by radiation?
Heat is transferred by three mechanisms: Conduction, Convection, and Radiation.
Conduction is the transfer of heat from one object to another when they are in direct contact. Heat from a warm glass of water is transferred into the ice cube floating in the glass. A hot mug of coffee transfers heat directly to the table it is sitting on.
Convection is the transfer of heat through the motion of a gas or fluid surrounding an object. At the microscopic level this is really just conduction between the object and the air molecules which are in contact. However, since warming of the air causes it to rise, more air is drawn toward the object which increases the rate of heat transfer. It is easier to think of this as a very different process than conduction.
Radiation is the transfer of heat through electromagnetic waves. All objects constantly radiate energy in the infrared spectrum. If you heat them enough, they will radiate in the visible spectrum glowing red, yellow, or white depending on the temperature.
Surrounding the earth, the vacuum of space doesn't contain very much matter. The vacuum isn't perfect. There are a few molecules per square centimeter. But there just isn't very much material there. Conduction and Convection into the vacuum of space does happen, but since there is so very little material to conduct heat, it doesn't happen very much. Nothing (or almost nothing) is in contact with the earth.
The atmosphere, the clouds, and the vacuum of space are transparent to radiation. Heat energy radiated into space can pass along to the farthest reaches of the galaxy easily.