I just replaced this intake CPS on my 2000 M5 thanks to the many contributions on this board. I'd like to consolidate the repair job here. This is the hardest of the 4 cam position sensors to get to so it should be a good reference:
Tools you will need: 10mm wrench (I recommend a small ignition wrench), 5mm allen wrench, phillips screwdriver, Peake Research code reader (not required but recommended ... and if you're DIY'ing this kind of job you're the type who needs one anyway). And finally, may you be blessed with patience and small hands.
Parts you will need: Intake cam position sensor (aka pulse generator, BMW part# 12 14 7 539 173
To be clear, this job is replacing the bank 2 intake cam position sensor, aka cylinders #5-8, aka USA driver side, aka right side of engine standing in front of car looking into the engine bay. This sensor is located in the back of the motor behind the intake cam.
From side of car
To get to it, first remove the cabin air intake filter housing and duct that connects to the firewall. The duct has several tabs that can be pry'd off with your fingers. Once free, gently twist the duct up and away from you, then pull the duct out of the firewall. This duct is held in by plastic tabs in the firewall that can be easily damaged. If you find yourself using force you are probably doing it improperly. Pic of work area with cabin air housing and duct removed
Next remove a black bracket by removing 2 10mm bolts, then prying the bracket out of the ignition wiring harness box. I found it easiest to remove the bolts from under the car. Here is a nice pic from under the car that Amrit50 took.

The rest of the job from up top. The bracket can be pry'd away with your fingers. Here is a pic of the bracket ... it slides into rubber grommets in the ignition harness.
You will now have access to the Intake CPS. remove the wiring connection by hand, then the 5mm allen bolt. The new CPS looks a bit different than the old one. I've decided this is a good thing ... these should not fail at 40K like mine did and earlier as others are reporting
Put in the new CPS and put everything back together. Take care with the bolts that hold the ignition wiring bracket ... this is a very tight space and they are easy to drop. Also take care with the cabin air duct. It needs to be pushed in completely before you give it an 1/8th turn to lock it into place. People on the board have experienced trouble with this. You might try shining a light down the duct when you start .. you'll be able to see the bottom tabs and it will help you line the tube up with the firewall hole.
Use your Peake to make sure your codes are clear, then fire your beast up and go for a spin ... one that is likely to be quicker than your last. Check for codes again just to be sure when you're done with your joy ride. Good luck!