Bathroom ventilation, via a ceiling-mounted vent fan, is important for indoor air quality and to prevent mould and other problems caused by excess moisture. It's also the best way to get rid of bathroom odours. A bathroom fan must be vented outdoors (never into the attic), and you can run the ductwork up through the roof, out through an exterior wall, or up, out and down through a soffit --- the panel covering the underside of the roof eave. There's a basic procedure for installing the ductwork between a standard ceiling-mounted vent fan and a nearby soffit.
Determine the location of the vent fan (if you're installing a new one) based on the bathroom layout and the best available ceiling joist/rafter bay. Vent fans are most effective when installed near the shower, and they vent most efficiently with short, straight duct runs. Install the vent fan following the manufacturer's directions.
Locate the area on the soffit that coincides with the rafter bay you plan to vent through. Drill a small hole through the soffit material, then use a bent wire to locate the neighbouring framing members. Use a jigsaw or reciprocating saw (for a wood soffit) to cut a hole through the soffit, sized for the vent cap, making sure to clear any framing. Install the vent cap/outlet over the soffit hole.
Run the ducting from the vent housing to the soffit cap. It's best to use rigid metal duct for all sections, or at least for straight runs. Otherwise, use flexible aluminium duct. Seal all transitions and joints with UL 181-approved duct tape. If necessary, begin the run with a short vertical section of duct to ensure a 1/4 inch per foot downslope (toward the soffit) for all horizontal duct sections. If the duct runs through an unheated attic space, wrap it with duct insulation to help prevent condensation.