Some gases such as ammonia, sulfur dioxide, butane, and (the infamous) chlorofluorocarbons (CFC's) can be easily squashed through a pipe by a compressor to make a liquid. You can demonstrate this with some lighter fuel in a plastic syringe (without the needle!) This is the condensation part. When this happens they get hot. This is part of the heat you feel from the pipes at the back of your refrigerator. The liquid cools as it gives its heat to the air in your kitchen. The cold liquid then travels through the pipe to the inside where it passes through a very narrow pipe into a larger pipe where the pressure is lower and it evaporates rapidly back into a gas. This makes it extremely cold. This is called the Joule-Thomson effect after the scientists who discovered it. Heat from your food warms the cold gas in the pipe and then it travels back out to the compressor where it all happens again.
A cool liquid is passed through metal coils inside the refrigerator. Heat from inside the refrigerator transfers through the coils to the liquid. This heat evaporates the liquid forming a warmer gas. After the warm gas leaves the refrigerator it is condensed back to a liquid and the heat is released into the room through other metal coils on the outside of the refrigerator.