Relais and Temperture

How do you detect that a problem occurred? Is that when the temperature rises over 100 degrees?

yes.

Is the fan supposed to be turned on when the temperature is above 50? Is it to be turned off when the temperature is below 50?

The Fan is seperate controlled by a sensor and speeding from slow to fast when the temperture rises. it will only stop cooling when the temperture is for example <25 celsius