If you park in a parking garage, on the side of the road or in congested car parks, you can expect to have your side mirror hit and damaged at some point. New mirrors have a plastic shell designed to take a moderate amount of abuse. Some even pivot when hit to minimise the impact. Sometimes the damage is too great, and the mirror and/or its shell breaks. If this happens, you'll need to remove the old mirror before attaching the new side mirror to your car.
Open the car door so you can access the cover that hides the mirror attachment bolts on the inside of the door. It's located on end of the door that attaches to the hinge.
Pull the cover off with your fingers. Generally they attach using plastic tabs that press into place. If the cover does not come off easily, inspect it for a screw holding it in place. Remove that screw if it is present, then try to pull the cover off.
Remove the wiring harness that connects the mirror's adjustment motor to the electrical system of your car. If the mirror does not have an electric motor--like many passenger side mirrors--skip this step.
Remove the bolts that hold the mirror to the sheet metal on the door. Usually, the mirror housing is held in place with three bolts. Use a long well socket and ratchet to remove the bolts. Be cautious, as it's easy to drop the bolt inside the door.
Pull the mirror shell out of the sheet metal on the door.
Slide the new mirror shell into the door, and secure it in place using the new bolts supplied with the mirror. If the mirror did not come with new bolts, use the old ones.
Reconnect the wiring harness that connects the mirror motor with the electrical system of the car. Again, if the mirror is not motorised, skip this step.
Press the cover back onto the door until each of the plastic tabs snap into place.