Like refrigerators, air conditioners create cool air by exploiting a basic physics principle: An expanding gas absorbs heat, or cools. Touch the side of an aerosol can while releasing its contents. The metal will cool rapidly as the gas inside expands to fill the space left by the exiting material. The air touching the exterior of the can cools as well. On a larger scale, exploiting this principle through cyclical compression and expansion allows air conditioners to carry heat out of a room.
Refrigerators and air conditioners use electric power to compress the gas, which then cycles through a system of metal pipes. The gas expands in the metal pipes, cooling the metal and thus the nearby air. After the gas warms, it leaves the area requiring cooling, carrying the heat out. Refrigerators have metal coils on their back sides to transfer the heat to the room air. Air conditioners also have coils that transfer heat, but theirs must transfer heat to the outside air.
If you install a through-the-wall air conditioner on an interior wall, the cool air and the hot air will cancel out. Similarly, if you leave a refrigerator door open, the cool air escaping the compartment will mix with the hot air near the coils on the rear of the refrigerator, resulting in no permanent change in room temperature.
Some systems feature an exterior air conditioning unit. Long ducts run throughout a building’s interior, typically across an attic. Small openings in the ceiling allow the ducts to exchange hot interior air with the cool air created by the air conditioner outside. Cost is the major disadvantage of such a system; routing ducts throughout a home can be expensive, and exterior air conditioning units aren't cheap.