Many bathroom fans here use a built-in timer so they turn on with the light and switch off a few minutes after the light goes off. The time delay is usually adjustable from a couple of seconds to sevreal minutes.

Personally, I prefer the fan to be on its own independent switch.