How does a refrigerator or freezer work to keep things cold?

Both the refrigerator and the freezer have fans to keep it at cold temperatures.

PV=RT;

A compressor raises the pressure of the gas volume V and temperature rises. A fan blows away the heat into the room. Then the gas pressure is dropped in the refrig cold room and the temperature drops in the cold room, PV=RT. The heat in the cold room heats up the gas and the volume goes to the compressorr again, ec,etc,etc.