Why does my engine rev up every 5-10 secs only when the fan is on? on 1999 Ford Escort

the air conditioner doesn't work and this problem occurs when the fan for either the air cond regular air is blowing. Even when driving I can tell that the engine rev is occurring.

Asked by for the 1999 Ford Escort