You've been watching too much American Idol
, you actually mean idle.
Your engine dying could be caused by a number of things but my first suspiciion is a bad CPS (crankshaft position sensor). Mounted on the engine, the CPS is what generates the engine's master timing signal and when it starts going bad, the engine will suddenly stall.
I don't know what you mean by the "cooling fan is flagging".