Bathroom fans help to get rid of excess moisture and smells. Preventing exhaust air from mixing with the conditioned airspace is the key.
In new construction, this ventilation can happen as part of the HRV / ERV system. The bathroom counts as one of your 'exhaust' points in ventilation balancing, along with the kitchen and utility room.
In a renovation, you will have to crawl up into the attic, or find a workable wall mount location.
Things to remember:
Use heat resistant caulking and tape
Ensure proper electrical hook-ups at the fan unit, the wall switch and out to the panel - always hire an electrician to do this work!
Use insulated pipe from the fan unit to the exterior and ensure a downwards slope to the exterior, just in case of moisture build up.