It's not just as simple as wiring up a solar panel to your existing fan I'm afraid. The fan in your shower room most likely runs on 220V AC power. A solar panel will put out somewhere between 10 and 30 volts DC power, depending on how sunny it is.
*if* you can find a reliable and very well made fan which will tolerate those voltages and not burn out, you could simply smash open the housing of your existing fan, replace it, then stick a solar panel on your roof and run some wires down to it. Simple.
However the fan would only spin when the sun was shining directly on it, and at varying speeds depending on how bright it was. Your shower room would quickly go mouldy as the moisture would almost never be extracted.
The better, but somewhat more expensive, option would be to have the solar panel mounted on an automatic tracking device, basically some motors and a swivelling turntable which follows the sun. Then, the panel would feed a battery charging system, some complex electronics which regulate the flow of energy and use it to charge a battery.
"all" you need to to then is wire up an AC inverter to that battery, and plug your fan into that rather than the mains. Since the power would be stored in the battery, it would be "on demand", so you could run the fan even at night. If you ran the fan too long it would drain the battery, so you should probably make sure it's a nice big one.
All of this would probably end up costing you hundreds if not thousands, so you'd have to question is it really worth it.