Question: We were moving some furniture around our house and knocked off a mezuza. Do we need to fast? Do we say a new beracha when putting it back up?
Answer: The Pischei Teshuva (YD 289:1) and Aruch Hashulchan (YD 289:4) write that just as one has to recite a new beracha when putting their tallis back on after it has fallen off (Shulchan Aruch OC 8:14), so too, one must recite a new beracha when rehanging a mezuza that fell (See Kitzur Shulchan Aruch 11:7).
R' Moshe Stern (Baer Moshe 6:6) adds that the same would apply if the top nail was dislodged, causing the mezuza to hang upside down.
However, R’ Ovadia Yosef (Yabia Omer YD 3:17:11) writes that one would not recite a new beracha when reaffixing a mezuza that had fallen. When a tallis falls off, one has already fulfilled the mitzva and is not required to put it back on. If one chooses to do so, one recites a new beracha. If one’s mezuza falls off, however, one is required to immediately reaffix it as the mitzva never ended (See Halichos Shlomo, Tefilla 3:14).
R’ Menashe Klein (Mishne Halachos 5:195) and R’ Yitzchak Yosef (Yalkut Yosef, Sova Semachos, Mezuza 106) write that one does not need to fast if one’s mezuza falls. They quote the Magen Avraham (44:5) who writes that there is a minhag to fast if one dropped one’s tefillin, though notes that no mention is made of one’s mezuza (See Shraga Hameir 3:12). They write that one should give money to tzedakah instead.
In conclusion, if a mezuza falls, one should replace it immediately. While Ashkenazim should recite a new beracha when they do so, many Sefardim do not. One should give tzedakah rather than fast.