A ceiling fan with a light fixture usually has two separate circuits -- one for the fan and one for the lights. Each of these has a black hot wire, and each should also have a white neutral wire and a bare ground wire, although there may be only one common neutral and one common ground to serve both circuits. If you want to wire the fan and lights to separate switches, you need two separate hot wires and the easiest way to accomplish this is to run three conductor cables from the fan to the switch box. The extra hot wire in this cable is red. Keeping this in mind, the wiring sequence is straightforward.
Check the Wires and Turn Off the Breaker
If the cable has already been pulled through the wall and ceiling from the switch box to the fan box, you'll see a white, black, red and neutral wire in the fan box, and you'll see the same four wires in the switch box. In addition, you'll see another black, white and neutral wire in the switch box. These are the circuit wires. Before making the connections, turn off the beaker in the main panel that controls the circuit and test the black circuit wire with a non-contact voltage tester to make sure it's dead. You're now ready to do the wiring job.
Hook Up the Fan and Lights
Before you connect any wires in the fan box, the fan has to be properly installed. Follow the instructions that came with the fan to accomplish this. Separate the wires inside the fan enclosure that service the fan and those that service the light. It doesn't matter which of the hot wires that lead to the switch you use to to connect each circuit, but by convention, the red one usually serves the fan and the black one serves the lights.
Connect the hot wire from the fan to the red switch wire, using pliers to twist them together clockwise, then screw on a wire cap to hold them together. It's important to twist the wires clockwise or they could come apart when you screw on the cap. Connect the hot wire from the light set to the black wire in the same way. Twist all the white wires together and cap them, and then do the same with the ground wires. You can now attach the fan enclosure to the electrical box and move on to make the switch connections.
Hook Up the Switches
You may have toggle switches to control both the lights and the fan, or one or both of the switches may be a dimmer. It doesn't matter. The wiring procedure is the same, although toggle switches usually have terminal screws and dimmer have wires. Either way, here's the wiring sequence.
Cut two lengths of black wire of the same gauge as the circuit wire that are about 6 inches long. Twist these two wires together with the black circuit wire and cap them to make a pigtail with two leads. Connect one of these leads to one of the terminals or wires on the fan switch and the other to the light switch. Connect the red wire from the fan to the other terminal on the fan switch and the black wire to the light switch. Twist all the white wires in the box together and cap them. Make a pigtail of the ground wire, using two 6-inch lengths of bare wire, and connect one ground wire to the fan switch and one to the light switch.
Screw the switches onto the box, then install a cover plate. The wiring is now complete. Turn on the breaker and test the switches.