According to the Ask the Electrician web site, a bathroom fan should be left running for at least 20 minutes after a person gets out of the shower. This will ensure that all of the humidity is cleared out of both the room and the ventilation ductwork.
Many people do not have time to wait for the humidity to clear in their bathrooms before they have to leave the house. According to Renovation Headquarters, a fan switch can be easily replaced with a 15-minute timer. When the timer goes off, the bathroom fan shuts itself off.
15 to 20 minutes is ample time for the humidity to clear. However, if you live in an area where the outdoor humidity is high and it takes longer to dehumidify the bathroom, a timer is the ideal solution because you can set it for an extra hour if you need to without having to worry about it running all day.