Computer fans need to be connected to the power supply in order to function, typically via the motherboard. Many basic fans have only two wires -- one for the ground or zero-volt connection and one for the positive connection. Your fan may also have a third wire, which carries a signal that tells the computer if your fan is working properly. The colors of the wires may vary.
Your computer may contain several different fans. The main central processing unit fan is very important, as the CPU gets very hot during normal operation and can be damaged by excess heat. The CPU moves air across the processor's heat sink to keep it cool. The case fan is usually located at the back, or sometimes in the side of your computer's case. Its job is to expel hot air from inside the computer while drawing in cool air. The computer's power supply can generate a lot of heat, and some power supplies come with a fan to vent this heat outside the computer case. High-end graphics cards may also use fans to keep them cool. You can add extra fans to your computer to improve air circulation.
Typically, the zero volt or ground wire is black, the +12-volt or +5-volt wire is red and the sensor wire -- also known as the tachometric, signal or revolution wire -- is yellow. In some cases, both the +12- or +5-volt wire and the signal wires are yellow. The signal wire may also be white, especially in fans made for Dell computers. Other colors are possible, but less common.
The color codes of the fan's wires help you to connect it correctly, but they're not your only guide. Most conventional connectors are keyed -- specially shaped so that they can only be connected in the right orientation. If you are connecting a three-wire fan to a four-pin connection, however, you will need to ensure that you use the correct three pins. The connector on the motherboard will often have the correct connections printed next to it. The ground wire is usually connected to pin one, the +12- or +5-volt wire to pin two, and the sensor wire to pin three.
Some computer manufacturers -- Dell in particular -- use proprietary motherboard connectors that are not compatible with generic fan connectors, although the wires are often arranged in the same way. You can find adapters that let you plug an aftermarket fan into a proprietary connector.