A humidifier works by taking in dry air from the environment and passing it over a wet surface or through a spray of water. The water evaporates into the air, increasing the humidity of the air in the environment. This process is often facilitated by a fan that blows the air over the wet surface or through the spray, allowing for efficient evaporation and humidification.