2004 Ford Focus cooling fan stays on when ignition is off?

It mainly does this after I have turned on the a/c. I have had to take off the battery cables to keep from draining the battery. Any ideas what is wrong?

Sadly, some designs have fulltime power to the relay for the fan. Hopefully it is just a sticking relay.

Does it stay on indefinitely or just for 15-20 minutes? Some cars keep the fan running even after the ignition is turned off to cool off the engine.

The fan is controlled by a thermostat. It will continue to run until the water temperature has cooled down enough. You shouldn't disconnect the battery but rather let it finish cooling down.

Stuck fan relay.

Some cars, mostly high performance ones, have fans that intentionally stay on for a while after you switch off. I doubt if your Focus is like that. The usual culprit is the fan relay which is wrongly feeding power to the fan continuously.