For SELV (Safety Extra Low Voltage) fans the transformer's usually located in the attic, or near by but out of reach of water. It's much the same way as some low voltage recessed lighting would be supplied. You can also get the transformer built into an over-sized switch box that can be located out of reach.
The advantage of using an SELV fan is that you can put it RIGHT IN the shower ceiling along with a recessed light often built into the same unit.
The other alternative is to use an in-line fan at the other end of a duct. Otherwise, you have to keep the fan well out of arms reach from the shower i.e. typically on the wall at the otherside of the bathroom.
UK/Irish bathroom regs for electrical appliances are EXTREMELY strict by any standard. You're not allowed to have any form out electrical outlet in the bathroom other than a special shaver socket which is only able to accept a special plug used on shavers and electric toothbrushes. It can only supply a tiny amount of power and is connected via an isolating transformer!
No wall switches are allowed either. This means that light switches are typically either located outside the bathroom in the hallway or, they're operated by pull strings and mounted on the ceiling. The strings must be non-conductive.
Drying your hair in a UK or Irish bathroom's just not allowed at all. Nor can you install any electrical appliances e.g. it's not unheard of in larger bathrooms in France to install a washing machine!
Most other European countries allow electrical outlets in bathrooms provided that they're protected by a RCD (GFCI). The UK/Irish approach has just always been very fixated on safety in the bathroom.
ii) PELV and SELV
Equipment may also be described as a Protective Extra-Low Voltage (PELV) or Safety Extra-Low Voltage (SELV) product. PELV products use low voltage but are connected to earth. SELV products are again of low voltage, but the voltage supply output is double insulated from the input. This enables a SELV product to be used in any zone in the bathroom providing the source (e.g. transformer) is housed in Zone 3.
This is the way they categorise the bathroom 'zones of protection'
Zone 0: the interior of the bathtub or shower basin.
Zone 1: the area around the bathtub or shower basin up to a height of 2.25m above the floor and at a radius of 1.2m from the water outlet.
Zone 2: is limited by the vertical planes external to zone 1 and parallel vertical plane (s) 0.60m external to zone 1.
Zone 3: is limited to the vertical plane(s) external to zone 2 and the parallel vertical plane(s) 2.40m external to zone 2.
Requirements: (Ireland, the UK is a bit different)
Zone 0 - IP 67 and Low Voltage
Zone 1 - IP 44 and Low Voltage
Zone 2 - IP 44 and Low Voltage or 220V with RCD protection
Zone 3 - Semi-Normal rules apply (RCD protection required)
Under absolutely no circumstances can a socket outlet or light switch be installed though! Only fixed appliances designed for bathrooms.
