An air conditioner works similar to a refrigerator. The refrigerant flows through the system, and changes in state or condition. There are four processes in the 'refrigeration cycle'.
1 The compressor which pumps the refrigerant around the system, is the heart of the air conditioner. Before the compressor, the refrigerant is a gas at low pressure. Because of the compressor, the gas becomes high pressure, gets heated and flows towards the condenser.
2 At the condenser, the high temperature, high pressure gas releases its heat to the outdoor air and becomes subcooled high pressure liquid.
3 The high pressure liquid goes through the expansion valve, which reduces the pressure, and thus temperature goes below the temperature of the refrigerated space. This results in cold, low pressure refrigerant liquid.
4 The low pressure refrigerant flows to the evaporator where it absorbs heat from the indoor air throught evaporation and becomes low pressure gas. The gas flows back to the compressor where the cycle starts all over again.
In case of a heat pump the cycle can be reversed.