Here's an answer for the B737, from own work compiled from several public sources. The A320 and other airliners are very similar.
The air conditioning packs are Air Cycle Machines (ACM) which remove heat from air through a reverse Brayton cycle. Hot compressed air is cooled and then expanded, which drops the outflow temperature to a temperature cold enough to provide cooling in hot environmental conditions.
The ACMs in the Boeing 737 are 3-wheel units consisting of a compressor, two heat exchangers, a turbine and an impeller fan. Bleed air is cooled in the primary heat exchanger, enters the ACM, is compressed further and cooled again in the secondary heat exchanger. The ACM compressor’s further temperature rise allows for more efficient cooling by the heat exchangers.
Cooling air for the heat exchanger is provided by ram air, via inlets underneath the fuselage, in front of the body/wing intersection. Water is extracted from the cool air, and sprayed into the ram air stream for more efficient cooling via the heat exchangers.
The impeller fan creates cooling air flow when airspeed is low. The impeller fan speed can be controlled independently from the ACM turbine/compressor axis, by the Turbofan Control Valve.