How does air conditioning work on a commercial airliner?
Came across this diagram that sums it up pretty nicely:




You get 'bleed' air from the engine compressor stage. On 'bleedless' aircraft, such as the B787, this is done by electric compressors instead.
Air temperature and pressure is adjusted as necessary in the conditioning packs since it heated up a lot when it was compressed.
Air is then distributed to the different 'zones'. A bit of the cabin air is recirculated. 
Some areas, such as the cockpit, generally receive air directly from the packs without recirculating at a slightly higher pressure, to blow possible smoke away from the interior and to prevent smoke being recirculated into the cockpit. For the same reason, you try create a flow out through the baggage hold.


Here is a more complicated diagram from avsoft's website for a CRJ200: