Why does the refrigerant release heat when it is compressed into a liquid? I've been trying to understand how an air conditioner works. And so far I've been able to understand that the basic working is
a cool gaseous refrigerant, is passed through a compressor. where it turns into a liquid. and that in turn goes through some coils, where it releases heat to the outside. Then it goes through some sort of regulator valve, that releases the liquid into a pipe where the pressure is lower, and so it goes back to the gaseous state, and it is cool now, so it can pass through coils. The ac then runs the hot air in the room through these coils, the gaseous refrigerent absorbs this heat  and cool air goes into the room and the refrigerent goes back to the compressor and the process continues. 
I have three basic questions, why would the refrigerent go back to liquid form when the pressure is increased in the condenser?
Why would this liquid then go on to release heat to the outside? 
And how does the refrigerent turn back to a really cool gas?
 A: First: how does a fridge work:

now its a tad blurry but this answers a lot of your question straght away
1) " why would the refrigerent go back to liquid form when the pressure is increased in the condenser?"
Boyles law states that with a constant temperature, pressure is inversely proportional to volume, so if you increase the pressure the volume decreases, which increases density (as mass doesn't change), condensing it into liquid
2) "Why would this liquid then go on to release heat to the outside?"
Because of the gas laws, if you compress something it heats up, from there you have a conductive metal which takes in a lot of the heat, you then have fans, which effectively increase the volume of air for which the metal is in contact with, increasing the rate at which it can lose heat to the surrounding air
3) "And how does the refrigerent turn back to a really cool gas?"
More gas laws! if you have a high pressure liquid / gas, then suddenly drop the pressure of it, it will cool down, which is also why a deoderant can goes really cold as you use up the last of it, you have decreased the pressure, so the temperature drops
A: Alex's answer was correct in respect to gas laws, and pretty accurately explains the answer to your third question, regarding what happens in the metering device.
However, regarding what is happening in the condenser, his answer was not quite true.
Questions 1 and 2 can be answered together. Firstly, there is no pressure increase in the condenser, if anything the pressure may drop slightly. Simply put, the condenser is rejecting enough heat from the refrigerant, for it to condense into a liquid. This is due to a temperature differential between the hot refrigerant and the outdoor air. For example, if you had gaseous water (steam) flowing through the condenser and losing heat content, it would leave the condenser as liquid water. This answers the second question; the liquid refrigerant is the result of the rejection of heat, not the cause of it.
If you would like to understand the refrigeration cycle further there are many resources online, however you should first understand pressure/temperature relationships with respect to boiling point. Then look to understand what is meant by the terms "superheated vapor" and "subcooled liquid" as they're used in the refrigeration industry. Maybe even check out how a refrigeration cycle looks on a pressure enthalpy diagram.
A: The refrigerant contains the same amount of heat whether compressed or not. When compressed, that heat is contained in a smaller volume, so the temperature is much higher. When the temperature of the refrigerant is higher than the hot outdoor air, it will release heat to the outdoors (function of the condenser coils). When it goes through an expansion valve and the pressure drops, the heat in the refrigerant is spread out in a larger volume, so the temperature drops to below your cool indoor temperature, allowing it to absorb heat from inside your house (function of the evaporator coils).
A: The fluid is chosen such that its phase composition (liquid, vapor, saturated) changes during the cycle.  It is the change in phase composition that explains the cycle. See the figures below.
Note the temperature change during the various stages of the cycle. For use as an air conditioner, the low temperature evaporator is the heat exchanger that removes heat from the higher temperature room to be cooled. Heat added to the evaporator changes the fluid from liquid to vapor. The high temperature condenser is the heat exchanger that transfers heat to the lower temperature outside.  Heat removed from the condenser changes to fluid from vapor to liquid.  The expansion valve flashes (rapid reduction of pressure) the liquid to two-phase liquid-vapor and this lowers the fluid temperature.  The compressor does work on the vapor and increases its temperature from saturation to superheated.
The cycle can also be used as a heat pump to heat an area; here, the condenser heats the room and the evaporator rejects heat to the outside.
Regarding your specific questions:
Why would the refrigerant go back to liquid form when the pressure is increased in the condenser?  Pressure is not increased in the condenser. The condenser is at a higher temperature then it surroundings and transfers heat out thereby lowering its internal energy resulting in a phase change from vapor to liquid.
Why would this liquid then go on to release heat to the outside?   The fluid in the condenser is at a higher temperature than the outside and therefore transfers heat to the outside. The fluid in the condenser enters as vapor and exits as liquid.
And how does the refrigerant turn back to a really cool gas? When flashed through the expansion valve the rapid reduction in pressure turns the liquid to a two-phase liquid-vapor and this causes a reduction in temperature of the fluid.  This is called a throttling process in thermodynamics.  This reduction in temperature is a characteristic of this change in phase composition.


