There is nothing quite so annoying, and dangerous, as a rear-view mirror that won't stay attached to the windshield. Fortunately, you can fix this problem permanently in just a few easy steps. You'll need to buy a double-stick pad - adhesive on both sides of a thin foam core - available at auto parts stores or home building centers. You may have to trim the pad with scissors to fit the back of the mirror mounting bracket.
Mark the location of the mirror on the OUTSIDE of the windshield using masking tape, then thoroughly clean the inside of the windshield glass to remove all traces of old adhesive and dirt. This is the key; the glass must be perfectly clean.
Similarly, remove all traces of old adhesive and dirt from the mirror mounting bracket.
Although some mirrors may be originally glued directly to the glass, it's easier to use a double-stick pad when carrying out a repair. Peel off the backing sheet from one side of the new mirror fixing pad, then push the pad firmly into position on the mirror mounting bracket.
Make sure the inside of the windshield is dry (try not to breathe on the glass, which may cause misting), then peel the remaining backing sheet from the adhesive pad, and align the mirror bracket with the masking tape outline made previously. Keep steady pressure on the mounting bracket for a few seconds and don't try to re-position it once you've pushed it into position.
If the mirror is separate from the mounting bracket, you can now slide the mirror into position on the bracket.