A bath fan timer powers the exhaust fan in your bathroom for a predetermined amount of time which is set by you on the timer. Once the timer reaches zero, it automatically disables power to the exhaust fan which turns it off. This saves energy since the fan doesn't run continuously. If it ran continuously, you would be losing warm air out of the exhaust duct when exhausting is not needed. You would also be consuming unneeded power. Wiring a timer is almost exactly like a switch.
Turn the power off to the exhaust fan in the breaker panel.
Locate the switch that controls the exhaust fan in the bathroom. Unscrew the switch's wall plate and remove it. Unscrew the switch and pull it out of the electrical box.
Unscrew the black wires from each of the terminals on the switch. Unscrew the green (ground) wire from the switch. Leave the white wires wire nutted together.
Examine your timer switch. It should have two black leads coming from it and a green lead. The black leads are the hot wires and the green lead is the ground wire.
Twist one of the black leads come from the timer switch together with one of the black wires in the electrical box. Screw a wire nut on to this connection. Repeat for the other black lead. If your switch has a line and load designation for the leads, the line lead should be connected to the wire coming from the circuit breaker panel and the load lead should be connected to the wire going to the exhaust fan. Twist the green lead from the switch with the green or bare lead in the electrical box. Screw a wire nut on to this connection.
Screw the timer switch to the electrical box and mount a cover plate over the switch. Restore power to your exhaust fan circuit.
Test the switch by turning it to one of the timed settings on the switch. The fan should turn on. Allow the timer to tick back toward zero. When it reaches zero, the fan should turn off.
Always make sure you turn the power off to the circuit before you work on it. Failure to do this will result in a severe electrical shock.