Removing the Mezuzah upon moving out:
Upon moving out of a rental home, the renter may not remove his Mezuzahs from the doors. [This applies even if one plans to place the Mezuzos on the doors of his new home. Furthermore, this applies even if a new renter is moving in simultaneously to his exiting the home and will replace the Mezuzos with his own Mezuzos. Some Poskim however rule that if one will not be able to find Mezuzahs for his new home, he may remove the Mezuzos and immediately place them on the doors of his new home, even if the old home will remain without Mezuzos.]
Rented from or to gentiles: If the house was rented from a gentile, or will now be rented to a gentile, he is to remove the Mezuzos [immediately] upon moving, [prior to the gentiles moving in]. [This removal is an obligation. This applies even if one knows that the gentile plans on renting it to another Jew.]
Paying for the remaining Mezuzos: When the renter leaves his Mezuzahs on the doors of the rented home, if he is particular on their cost, the second person [the next renter who moves in, or from the owner, if he is moving in] must pay him for the Mezuzahs. [However, even if the person that moved in refuses to pay for them, the renter may nevertheless still not remove the Mezuzahs.]
Circumventing the prohibition:
It is possible to circumvent the prohibition, and retrieve one’s Mezuzos, in the following ways:
1. The new renter or owner comes to the home and removes the Mezuzos of the previous renter and replaces it with his own Mezuzos.
2. The renter may remove the Mezuzos to be checked and then replace them with other Mezuzos of the owner, or renter, or of a Gemach. The Gemach may then remove their Mezuzos if other Mezuzos of the owner or new renter are immediately placed on.
3. The renter may remove his Mezuzos [even not to be checked] and immediately replace them with other Mezuzos and then immediately place them in his new home.
4. The renter may purchase the Mezuzos of the owner/new renter in exchange for his Mezuzos, and then remove his Mezuzos and place the “newly purchased” Mezuzos on his doors, and then buy back his Mezuzos from the owner/new renter.
5. Some Poskim rule the renter may paint the home and remove his Mezuzos in order so they don’t get ruined with the paint. Once they are removes he is no longer required to replace them.
If one sold his home to another Jew, may he remove the Mezuzos from the home?
If one plans to demolish a room/house may the Mezuzos be removed?
If the renter placed borrowed Mezuzos on his door, may they be removed upon moving?
If the doors originally had Mezuzos of the owner and were replaced with the renters Mezuzah, may the renter remove the Mezuzos and replace the owners Mezuzos to the doors upon moving?
 Michaber 291/2; Tur C.M. 314; Smeh C.M. 314/8; Baba Metzia 102a
 The reason: As this allows Mazikin [evil spirits] to enter the home, and it is thus considered as if one damaged the home with his bare hands. [Tosafos Baba Metzia 101b; Smeh ibid; Aruch Hashulchan 291/3] Alternatively, the reason is because there is danger that his children will die [as is told in Gemara that once a renter removed his Mezuzahs and he ended up burying his wife and two children]. [Bava Metzia 102a; Sefer Chasiddim; Beis Lechem Yehudah 291] Alternatively, the reason is because the Mezuzos draw the Shechina onto the home and when one removes it, it causes the Shechina to depart. [Ritva ibid] Alternatively, the reason is because the person entering the home may be lax in placing Mezuzos on the doorpost. [Birkeiy Yosef ibid; Rishon Letziyon 291] Alternatively, it is because it is a belittlement for a Mezuzah to sit idle without use. [Shelasos 126 Beshalach; First explanation in Tosafus Shabbos 22a]
 Tosafos Baba Metzia 101b; Ritva ibid; Implication of Michaber ibid, as brought in P”M 15 M”Z 2; Beis Yosef 291 in name of Tosafus; Darkei Moshe 291/1 in name of Hagahos Ashri; Beis Lechem Yehuda 291; See Birkeiy Yosef 291/3
The reason: As through removing the Mezuzos the Mazikin enter into the house and this causes damage to the new tenants. [Tosafus ibid] Alternatively, the reason is because the Mezuzos draw the Shechina onto the home and when one removes it, it causes the Shechina to depart. [Ritva ibid]
Other opinions: Some Poskim rule that if one will immediately place the Mezuzos on the doors of his new home they may be removed just as is the law regarding Tzitzis, that one may remove Tzitzis from a Tallis if he plans to tie them to a different Tallis. [Rav Acha Mishavcha Gaon in Sheilasos Shelach; Ritva Baba Metzia in name of Rav Haiy Gaon; Nimukei Yosef in end of Hilchos Mezuzah [although leaves in Tzaruch Iyun]; First explanation in Tosafus Shabbos 22a, brought in Birkeiy Yosef O.C. 15 and Y.D. 391/3, brought in Pischeiy Teshuvah 391/7; Eshkol]
 Conclusion of Birkeiy Yosef 291/5, brought in Pischeiy Teshuvah 391/7; See there for the different sides for answering this question and that in conclusion it is logical to say the Sages did not differentiate in this matter.
 Birkeiy Yosef O.C. 15 and Y.D. 391/3, brought in Pischeiy Teshuvah 391/7, that in a time of need one may rely on the ruling of Rav Haiy and Rav Acha Gaon; Yad Avraham 291; P”M 15 M”Z 2
Other opinions: Some Poskim leave this ruling in question. [Aruch Hashulchan 291/3]
 The reason: This follows the reason of the Shelasos brought in previous footnotes.
 Michaber 291/2; Baba Metzia 102a
 Shach 291/3
 Shach ibid
 Sheilas Yaavetz 2/122, brought in Pischeiy Teshuvah 291/9
The reason: In order so the gentile does not cause the Mezuzah any belittlement. [ibid]
 Sheilas Yaavetz 2/122, brought in Pischeiy Teshuvah 291/9; Beis Lechem Yehudah 291
Other opinions: Some Poskim rule that if one knows another Jew will be moving in it is forbidden to remove the Mezuzos. [Aruch Hashulchan 291/3; Shulchan Melachim 11/185
 Rama 291/2; Sheilasos; Ritva; Beis Yosef in name of Rabbeinu Manoach
Other opinions: Some Poskim rule it is not necessary for the owner to pay the renter for his Mezuzos, but is simply a good act, and cannot be forced upon the owner. [Implication of wording of Beis Yosef in name of Rav Manoach that it is “a good thing to pay”; Ritva, brought in Shita Mekubetzes that it is only “possible” that he must pay]
 Literally “hasheyni” which means the second person.
 Bach 291; M”A 437/6 as explained in Machatzis Hashekel there; Chayeh Adam 15/23; Aruch Hashulchan 291/3; Igros Moshe 4/44
 See Pischeiy Shearim 291/12
 Seemingly one may only demand money from the owner if the owner is moving in, as if not, why should he need to pay for the renters Mezuzos if he has no obligation to have Mezuzos on his home being he is not living there. However, if new ten nets or buyer enters the home they would be required to pay.
 Aruch Hashulchan 291/3
Other opinions: Some Poskim rule that if the owner refuses to pay for the Mezuzos then the renter may remove them. [Ritva and Eshkol of Raavad, brought in Shita Mekubetzes, brought in Birkeiy Yosef 291/4, Chelkas Yaakov 3/160]
 See Kevius Mezuzah Kehilchasa 14 footnote 16; Lehoros Nasan 6/126
 Daas Kedoshim 291/1; Chelkas Yaakov 3/160; See Kevius Mezuzah Kehilchasa 14 footnote 16; Perhaps this is permitted even if he does not immediately replace the Mezuzos by his home as the Mezuzos were removed in a permitted way, for the sake of checking. Vetzrauch Iyun.
 See Chelkas Yaakov ibid regarding switching for less Mehudar Mezuzos; So seems Pashut that it is permitted to do so, as he is not transgressing any reason brought in Poskim for the reason of the prohibition and so is implied from Birkeiy Yosef 291/6 that if he himself will be placing other Mezuzos it is permitted and so rules Chelkas Yaakov ibid that in truth even if he removes it not for the sake of checking, but simply to place in his own home it is permitted; However see Igros Moshe O.C. 5/44 who is stringent in general against switching a more Mehudar mezuzah for a less Mehudar one.
 See Kevius Mezuzah Kehilchasa 14 footnote 16
 Igros Moshe O.C. 5/44 in name of Rav Henkin
 Shivas Tziyon 110, brought in Pischeiy Teshuvah 291/8
 P”M 15 M”Z 2 regarding if people no longer plan to live in the building; Daas Kedoshim 291/1
 Sheilas Yaavetz 2/119; Minchas Yitzchak 10/96
 Chelek Halevi 114
 So seems Pashut that it is permitted to do so, as he is not transgressing any reason brought in Poskim for the reason of the prohibition. See Chelkas Yaakov ibid