This DIY applies to all E39 5 Series 97-03.
OEM cup holders are notorious for breaking because they are extremely flimsy and there aren't any other cup holder locations. If you are lucky, the cup holder will break while open so there is access to the Phillips screws. If the cup holder is broken while closed and you cannot open then removal of the audio and climate controls may be necessary. A small flat head screwdriver may be used to pry open the flanges from the side to access the screws.
Luckily there are aftermarket options that are durable and cheap. The only downsides are they take up the tray area because there aren't flanges and accessibility to the climate control may be difficult with drinks.
I went with the
FGT Motorsport E39 Front Cup Holder Upgrade which has been working great. Every aftermarket cup holder looks exactly the same and another good one is the
TrunkNets E39 Premium Front Cup Holder.
I have added pictures below of what the aftermarket cup holders look like and how they attach to the tray.
If the flanges are open:
Locate screws on cup holder and remove using Phillips screwdriver.
Cup holder removed to reveal cheap flimsy plastic parts.
Cup holder removed.
Remove tape cover and attach aftermarket cup holder to tray.
Done! Enjoy your drinks without having to holding them in between your legs. The FGT cup holders are very sturdy and I can fit large drinks in them. No more annoyance looking down at seeing broken flanges, they are replaced with a clean and classy aftermarket mod.