Could be a problem with the fan or the switch controlling it. Could be a lose connection anywhere on the circuit.
Follow Joeds advice you very likely may have a bad connection to a receptacle. Are you comfortable with working on electric. It would be a good idea to learn how to use a voltage tester they are inexpensive but a necessary tool.well it a newer fan i pluged it in a other room and works great well last night middle of night it just came on the lights in my bedroom and hall