Our parsha includes the mitzva of mezuza, as part of the familiar portion of the Shema: "And you shall write them on the doorposts of your house, and upon your gates". (Devarim 6:9.) The mitzva is to write the two parshiot which mention this mitzva, here and in Ekev (Devarim 11:20) on an appropriately prepared parchment, and to place the rolled-up parchment on the upper third of the right-hand doorpost.
Our tradition records many profound insights into this mitzva which find expression in the details of its observance.
What kind of room requires a Mezuza
Two kinds of room are exempt from a mezuza: a bathhouse or other unclean places, and conversely a Beit Knesset or other place used exclusively for G-d's service. The one is exempt because it is so far from holiness; the other exempt precisely because of its holiness. (Yoma 11, see SA YD 286.)
The mitzva of mezuza, and indeed mitzvot in general, are about sanctification more than they are about sanctity. HaShem is perfectly holy; the creation of the material world brought with it the possiblity of giving Him a "nether dwelling". (Tanchuma Naso.) This possibility is primarily realized through the actions of the Jewish people in spreading holiness through those aspects of the material world which are susceptible to sanctification. This excludes those aspects of the world which are too base for us to sanctify, as well as those which are not in need of our actions.
What kind of entrance is obligated?
A mezuza must be placed on the opening of each room, not only on the main entrance. The SA records that an "opening" is not considered a doorway for the purposes of this mitzva unless it has two doorposts and a lintel (an overhang from the ceiling). If either the right or left side of the opening is flush with the wall, or if the top of the opening is flush with the ceiling, no mezuza is required. (SA YD 287:1. Though some hold that the left side only may be considered a doorpost even if flush with the wall – see Shach s.k. 1.)
The requirement to have a mezuza in each room means that whenever we move from one domain, one sphere of activity, to another, we must renew our consciousness of G-d's presence and act in our new locale in a way which sanctifies His name. The best approach to serving HaShem in one environment may not be appropriate in other surroundings.
The requirement to have the mezuza specifically at the entryway reminds us that this consciousness must be present from the very beginning of each new undertaking.
Finally, the requirement for a doorway – doorposts and a lintel - reminds us that every opportunity, every new domain, necessarily implies restriction. If the move from one place to another does not constrict us, then we have not really gotten anywhere new. In particular, the requirement for a lintel on top reminds us that new opportunities may require us to stoop a bit – to diminish ourselves.
Location of the Mezuza
The gemara learns that the mezuza must be on a person's right as he enters the room – the word "your house" ("beitecha") can be rendered "as you enter" ("bi'atcha"). The right represents the positive, dominant aspect of things, "Your left should repulse and your right draw near" (Sota 47a). We enter the room on the right foot, and with the right attitude of remembering HaShem. (Menachot 34a.)
The Zohar points out that as a result, as we leave the room the mezuza is on our left – seemingly focusing our attention on the absence of holiness! The cryptic reply is that the negative influence associated with the lack of a mezuza "voluntarily" moves to the left, the side of a person's yetzer hara (evil impulse), where it is subdued by the holiness of the mezuza. (Zohar Vaetchanan III:263b.) Here is one way of understanding the Zohar's insight.
We have control of our home environment. A house can be the abode of holiness and righteousness, or G-d forbid of the opposite. When we see the mezuza on our right as we enter, we are reminded to create the proper kind of atmosphere inside.
Unfortunately, this atmosphere is not able to protect us as we leave the house. On the contrary, as we depart the mezuza is now on our left! The very act of leaving the sheltered environment could symbolize rejecting our values, symbolized by the repulsing left. Now we are in danger of being motivated by the values of the street – symbolized by the mezuza-less doorpost which is on our right as we leave.
Fortunately for us, the values of the street seldom masquerade as our yetzer tov. On the contrary, they readily identify themselves with our yetzer hara. Rock songs don't tell us that violence and licentiousness are moral and holy; they tell us to go ahead and indulge our urge to immorality and defilement. Once we correctly identify these values with the side of wickedness (represented by the left), we are motivated to evaluate them in the light of the moral education we received in the Jewish home (represented by the mezuza), and we are able to overcome them.