In my opinion the simplest way to do this is using a device that detects when mains power is restored. You can use a Ring Extender as suggested by @rlithgow1, or just build a device that detects power loss/restoration.
Here's an example of such a device:
And then use a rule like this:
Required expression: When mode is Sleep
Trigger: Power is restored
Actions: Turn on Fan.