This was done on an '03 Ram 2500. Should be the same for all generations but not sure.
I'm gonna explain the removal & installation on a right 3rd gen mirror. Left side will be the same but use opposite directions.
To remove, adjust the glass in towards the truck, i.e. hold down the left arrow for mirror. Grab the right side of the glass and push it to the left until you feel & hear it click. It is now popped free from the mating surface.
If you have heated mirrors, there are 4 wires on the back of the glass. Note where the belong and remove them. They just slide on/off.
This is the inside of the mirror housing. The circle is what hold the glass & pivots. To orient yourself, the truck is on the left and the outside of the housing is on your right. You can see in the 4 corners of the circle there are, what looks like, horseshoes on their side. There are opposing clips on the glass that slide in there.
Next picture is the back of the glass, the end closest to my wrist is the bottom.
Here you can see the 4 clips around the edge of the circle. You will also notice 3 metal clips outside the edge of the circle. If you look back at the first picture, I have circled 3 pieces of plastic that come up and almost wrap around the circle at the 12 o'clock, 4 o'clock and 9 o'clock positions. Those metal clips on the glass need to be positioned between the round mating surface and the pieces I circled in the first pic.
This is just a closer look at the clips that hold the glass on the inside of the housing.
Installing the glass is easiest done if you fold the whole housing toward the front of the truck. Whether or not you have auto or manual mirrors you need to adjust the round mating surface in the housing so it's away from you. Basically, if they're electric hit the right arrow until it doesn't go any further.
First step is to get those metal clips in place, next get the plastic clips in place on the round mating surface in the housing. Before you try to slide the mirror to get the plastic to lock in place have another person adjust the mirror down and to the left. Now you can see down from the top and pull the mirror into place. Slide the glass to the right and you'll feel it click in. Give it a couple pulls in different directions to make sure all 4 clips made it in.