The white wire is wrapped with black tape to identify it as hot. The black wire connects the fan to the speed controller. The red wire connects the light to the dimmer.
To wire a 3-way switch circuit that controls both the fan and the light, use this diagram. As with all 3-way circuits, the common on one switch is connected to the hot source wire from the circuit. The common on the second 3-way switch is connected to the hot wires on the fan/light.
Here the exhaust fan is controlled by a timer instead of a switch. There should be two hot wires and a ground coming out of the timer casing, splice one of these to the hot source. Spice the second to the black, cable wire running to the fan. Splice the source neutral to the white cable wire and the ground to the ground wires. At the fan splice the wires, matching the colors of each.
This ground fault circuit interrupter wiring diagram of the same device leaves the switch out of the protected circuit. With this arrangement the receptacle is protected but the switch remains outside the circuit. This arrangement can be used to control a light or other device where the extra protection of a gfci is not necessary.