Disconnect from the electrical supply and remove the whole appliance. deposit the whole contraption in the waste bin, and purchase a new appliance.
When connected this should cure the annoyance.
Usually means that the transformer circuitry is on its last legs. Best advice is to replace it.
If the fan is sited within one of the bathroom electrical zones, then it should be an extra-low voltage type (12 volt), but if not, it could be replaced with a more common mains voltage model with the circuit protected by an RCD (trip.)
TB....it still amazes me that come councils insist on a 12v fan in a bathroom...however when questioned about their choice they are unable to justify a 230v 40 amp shower pouring water over your naked body..and until recent changes was only protected by at best an mcb.
Good point BS. I did wonder who would specify a 12v fan!
Such a simple measure too, to have bathrooms covered with an RCD. We all still come across high rated showers added to an old re-wireable consumer unit.... with no RCD.
......... and who can get their head around a disconnection time 0f 5 seconds, but I guess, with BS60898 mcbs, it's academic anyway.