Arduino crashes switching 230V relay OFF
Since your problem goes away when the fan is disconnected, it sounds like your problem is due to the inductive spike caused from switching off the fan. If it were a DC circuit, the solution would be a flyback diode, however since this is an AC fan, you need a Snubber &amp;/or a high-voltage clamp such as a bidirectional TVS diode (transient voltage suppressor) or an MOV (metal-oxide varistor). Besides causing "erratic operation", the inductive spike can also result in shorter life of your relay contacts.

You can make your own snubber or you can purchase one off-the-shelf such as Red Lion SNUB0000. Refer to the Red Lion SNUB0000 datasheet for application information. The best place to connect the snubber is in parallel with the fan.

The snubber alone will probably be sufficient, but if you provide a voltage clamp such as a bidirectional TVS diode or MOV, it must clamp at a voltage greater than the maximum peak voltage of your 230V line. Remember to account for the fact that your line voltage is un-regulated and may go higher, and 230V is RMS (not peak).