Sorry, no diagram, but here goes.
Relay coil to one light S/L, relay pulls in when that light is on.
Contact (needs to be C/O) common to fan S/L input.
Connect contact N/O to same S/L as coil.
Connect N/C contact to S/L on other light.
Switching one light on pulls in the relay, changes over the contacts, and applies live to fan control. Fan runs.
With that light off, tge fan is controlled by the other light as if the relay wasn't there.
The above assumes bith lights on same circuit. If on different circuits, relay coil S/L & N come from one circuit. The N/O contact must connect to the permanent L the fan is connected to - needs an extra cable core.

