How does heat work in the refrigeration cycle?
Work is done on a refrigerant to move heat from a cooler area to a warmer area.
A basic refrigeration cycle looks like this;
In the diagram above, a liquid refrigerant is passed into thermal contact with the air to be cooled. Because the liquid is at a lower temperature than the air, it absorbs heat from the air. The absorbed heat causes the refrigerant to evaporate. The gaseous refrigerant is then compressed, causing it to heat up. Work must be done on the refrigerant in order to compress the gas.
The hot gas is then placed into thermal contact with the warm air. Since the gas is now warmer than the air, heat is transferred out of the gas, allowing it to cool. As the refrigerant gas cools, it condenses back into a liquid. The liquid is then allowed to expand. The pressure drops and the liquid cools. This cooled liquid then repeats the cycle.