Choosing a location for your bathroom exhaust fan involves two practical issues: where the fan will most easily accomplish its mission, and where the ductwork can be run most efficiently.
Follow the Moisture
First, the fan should be located in the area of the bathroom that is exposed to the most moisture. This is usually the area over the bathtub or shower. The goal of the exhaust fan is primarily to remove wet, humid air that can cause mold or moisture damage, and your bathroom will exhaust most quickly if you position the fan over the area where there is the most moisture.
You can place the fan directly over the bathtub or shower base, but it's sufficient to position it anywhere near the bathing area. If the bathroom has both a tub and shower, or a shower and a whirlpool tub, the fan should go somewhere between the two fixtures.
If the bathing area is in its own room, that room needs its own fan, and you might want to add another fan for the main bathroom area, or wherever the toilet is located.
Plan Your Vent Ductwork Route
Next, plan the bathroom exhaust fan location so that the duct has the shortest and most direct route to the roof or wall vent. It's best if the fan is within six feet of the exterior vent cap where all the moist air escapes to the outdoors, with the straightest route possible. Longer duct runs make the fan less effective and increase the likelihood of condensation inside the duct.
You can terminate the duct through the roof or a gable wall or even down through a soffit (if you use a special vent cap).
Avoid venting through a wall below a soffit (the eave overhang of the roof), as this can trap moisture under the eave overhang.
Check the Attic
Head up to the attic with a tape measure to scout your bathroom exhaust fan location from above the ceiling. Measure from an exterior wall, a plumbing vent pipe, or electrical boxes in the ceiling to find your bearings.
(It also helps to have a helper below measuring inside the bathroom, communicating measurements by cell phone).
Make sure you can install the fan between two ceiling joists and that there is enough room to make the transition from the fan housing to the duct. Also make sure the vent cap will be well clear of obstructions and trouble areas of the roof—things like roof valleys, skylights, chimneys, or furnace or water heater vents.
Drill a Locator Hole
Before cutting the hole in the ceiling for the fan housing, use a drill and a small bit to drill a pilot hole through the ceiling material at the center of the fan location. Head back to the attic to confirm that the location will work and that there are no plumbing or wiring runs in the way. The locator hole is much more accurate than measuring from neighboring features. Use the same technique when it's time to cut a hole in the roof or attic wall for the installation of a vent cap to terminate the ductwork.