A usefull article written by Dudley Doright.
"The initial test - turn on the AC. Does the fan run? No? Then in all likelyhood the fan has gone deceased.
Why? The E39 likes to suck up leaves and crap into the fan. These build up behind the fan, clogging up the guts, and eventually it doesn't run. BTDT with my '98. New fan lists for $330, takes about an hour (if you have the right tools) to install.
To test the fan itself, you'll need a source of 12VDC (I use a motorcycle battery). The connector for it is on the upper left side of the housing. Disconnect it. You'll find a bunch of female pins on the connector going to the motor. I don't have the wiring diagram handy (I traced it out), but the BIG wire is ground. Put negative to that wire. Connect positive to any of the other pins. The fan should run. It should run at a different speed for each pin. It has 3 speeds, from VERY FAST to AWFULLY FAST to FAST.
If it runs on all three speeds - the motor and resistor packs are OK (the resistors are mounted on the fan housing). Your problem is either the temperature sensor OR the fan relay. The temperature sensor screws into the back of the radiator on the reservoir side. Has a green connector going to it (from memory). IF the fan motor ran in the test above, you can jumper pins on this connector to test the relay pack. I don't have the pinouts handy (but if you post your email address I'll contact you directly).
If the fan motor works, and jumping the wiring from the temperature sensor works - then it's the temperature sensor that's bad.
If the fan motor works, and jumping the wiring from the temperature sensor doesn't work - it's either the fan relay or the fan fuse that is bad. Dunno where the fan relay is, because I never bothered looking for it once I figured out my fan motor was bad.
If the fan motor is bad - you have three choices:
1. Throw $330 to the parts guy and buy the fan and install it yourself.
2. Throw even more money to the service department and have them install it (it isn't THAT hard a job.. I did it after dark in less than an hour, and that included cleaning all the crap off the front of the AC condensor that was behind the fan shroud.)
3. Take the old fan out and try to fix it. Then reinstall it. I did fix the old fan (it's in my loft in the garage as a spare now.. I did #1). Turn the fan over, use your air-compressor to blow as much of the crap out of the inside of the motor as you can. The motor is swaged together - meaning you can't take it apart. Then spray electrical contact cleaner into the cooling holes in the back while spinning the blade. Let it dry. Connect it to a 12V source and try spinning it by hand. Mine initially didn't do much, but after lots of hand spinning, the motor started to catch intermittently. I repeated the air-blasts and contact cleaner, and connected it again. It got better. I kept blasting it out, running it, and eventually started spritzing WD40 in the holes. After a few hours of this kind of playing around - it ran just fine - on all 3 speeds. It went back into the box the new one came in and got stored away as a spare.
If you are in NJ - you're welcome to borrow my spare while you fix your fan..
If you leave an email address here (The 5 Series (E39) Message Board) , I'll pass along a website link that has the wiring diagram of the fan motor on it (I traced it out).. which will help you in the initial troubleshooting.
Oh - how to prevent this happening with your new/fixed fan? I made up leaf guards from 1/4 mesh 'chicken-wire' (hardware cloth) that fit the two grilles in the hood, and the big bottom opening. Painted black they aren't really noticeable (and if you do notice the ones in the grilles they look cool mounted behind a chrome-slat grille). These have worked great - the bottom one has caught LOTS and LOTS of leaves this fall that would have been munched up by the fan and packed where you can't clean'm out. Sometime I gotta take some pics of these and put them up on the web. HIGHLY recommended modification."
From BMW tips and tricks.