• first tilt the mirror downward
• remove the plastic cap that houses the electrical connector
• next holding the arm firmly which connects to the windshield, twist it counterclockwise, then pull straight off
• pull the electrical connector out by depressing the tabs on the outside
Video tutorial on how to remove the rear view mirror on a BMW E39. A similar procedure is also used on a BMW E53 and E83 and possibly other BMW models as well. This particular procedure was done on a 1997 BMW 540i.