Air conditioners work by cooling the air and simultaneously removing moisture (dehumidifying) from it, thereby controlling both temperature and humidity to create a comfortable environment.