I replaced the AC compressor on my 1998 E39 528i with 160K back in July 2016. It is an M52 engine, so it is very similar to M54 engine.
I wrote a very detailed DIY here:
DIY: 1998 BMW 528i 160K Replacing AC Compressor
https://www.bimmerfest.com/threads/d...ressor.924320/
Key things:
1. Do NOT trust the amount of oil that comes with it.
Drain it and measure proper amount of oil yourself.
2. E39 AC compressor is Denso.
E53 X5 is Calsonic.
I'd stick to whatever brand the came from the factory.
Avoid aftermarket AC compressor.
3. Do it on a dry non-humid day.
4. If you rent the vacuum machine, check all the O-rings.
They are often damaged by the previous renters.
5. Replace all O-rings. Use only BMW Genuine O-rings.
6. Dryer...up to you.
7. Valves...up to you.