Computer fans are sometimes noisy and irritating, but they perform the very important function of cooling the computer, specifically the central processing unit. If this component reaches a pre-set temperature, the computer will shut down. This is called a "thermal check," and mainframes, servers and personal computers all have this protective feature built in.
Computers Produce Heat
Computers of all shapes and sizes produce heat as they consume electricity and move it around their circuitry. While you might not think such small chips could produce that much heat, they do. The circuits are very compact and layered in the chips, and with electricity moving through them at the speed of light, a lot of heat gets generated. The power supply also produces heat as it supplies power to the computer.
Fans Cool Computers
The role of the computer fan is to pull cooler air into the computer to cool the hot circuitry, particularly the CPU. In a desktop the fan is typically a part of the power supply and draws air through it, helping to keep that part of the computer cool. If a computer's CPU gets too hot it will typically lock the computer, requiring a shutdown and reboot. If the computer does not have thermal check capability the overheating could result in a fire.
Computer Air Vents
The fan cools the computer by pulling air in through any vents or openings in the computer, including the keyboard in the case of a laptop, or drive openings in the case of a desktop. It is important to be sure that you do not block air vents, or the computer may overheat and either shut down or damage the components. It is especially important that you not put a laptop in its case while it is turned on. This could cause overheating and possibly a fire.
Dust Heats Computers
As the fan pulls in cooler air from outside the computer, it also pulls whatever is in the air. This typically means dust, and dust is the worst enemy of computers aside from heat. The static electricity of the computer chips form a dust magnet of sorts, and layers of dust can build up on the chips, causing more heat. It is important that you open your computer and clean out the dust from time to time to avoid damage to your computer's components.