The refrigeration cycle uses a fluid, called a refrigerant, to transfer heat from one place to another. We usually think of the cycle being used to create cooling, but if you have ever felt the backside of a refrigerator or air conditioner, you know the cycle also produces heat. This is especially true of a heat pump, which is really nothing more than an air conditioner that is able to reverse where it puts the cooling and where it puts the heating.
The key to understanding how it works is recognizing that at the same pressure, the refrigerant boils at a much lower temperature than water. This is a critical concept to understanding how the refrigeration cycle works, so if that went by too fast, read it again and think about it for a minute. For example the refrigerant commonly used in refrigerators boils between 40° and 50°F as compared to water's boiling point of 212°F.
Let's look at the process to see how boiling and condensing a refrigerant can move heat. The process is the same whether it is operating a refrigerator, an air conditioner or a heat pump. This example illustrates air conditioning.
The cool, liquid refrigerant enters the indoor coil, also known as the evaporator. As its name implies, refrigerant in the evaporator "evaporates". Upon entering the evaporator, the liquid refrigerant's temperature is between 40° and 50°F; and without changing its temperature; it absorbs heat as it changes state from a liquid to a vapor. The heat comes from the warm, moist room air blown across the evaporator coil. As it passes over the cool coil, it gives up some of its heat and moisture may condense from it. The cooler, drier room air is recirculated by a blower into the space to be cooled.
The vapor refrigerant now moves into the compressor (which is basically a pump that raises the pressure), so it will move through the system.
Once it passes through the compressor, the refrigerant is said to be on the "high" side of the system. Like anything that is put under pressure, the increased pressure from the compressor causes the temperature of the refrigerant to rise. As it leaves the compressor, the refrigerant is a hot vapor, roughly 120° to 140°F.
It now flows into the outdoor coil, (known as the condenser). Again, as the name suggests, the refrigerant condenses here. As it condenses, it gives up heat to the outside air, which is blown across it by a fan. The outside air is able to pick up heat from the coils because even though it may be over 100°F, it is still cooler than the 120-degree coils. This is the hot exhaust air you feel when passing the outdoor unit of an operating air conditioner.
As the refrigerant leaves the condenser, it is cooler, but still under pressure provided by the compressor. It then reaches the expansion valve. The expansion valve allows the high-pressure refrigerant to "flash" through becoming a lower pressure, cooled liquid. When pressure is reduced (as with spraying an aerosol can or a fire extinguisher), it cools. The cycle is complete as the cool, liquid refrigerant re-enters the evaporator to pick up room heat.
In summary, the indoor and outdoor coils (condenser and evaporator) are where the refrigerant changes "phase", absorbing or releasing heat through boiling and condensing. The compressor and expansion valve facilitate the pressure changes, increased by the compressor and reduced by the expansion valve.