The term mezuzah most correctly refers to the small scroll containing the words of the first two paragraphs of the Shema (Deuteronomy 6:4-9 and 11:13-21). The parchment is rolled up and placed in a case, which is affixed to the doorpost, according to the commandment of Deuteronomy 6:9 ("You shall write them on the doorposts of your house and on your gates"). Some people use the term mezuzah to refer to the case and the scroll together. However, the case alone, is merely a case. To be most precise, the word mezuzah means "doorpost" for that is where the words referred to in Deuteronomy 6:9 are to be adherred. Long ago, an awl or other tool was used to gauge out a trough in the doorpost of the entryway to one's house. The scroll was inserted into the gauged-out space and plastered over. Today, when people move frequently, it is customary to encase the mezuzah scroll in a decorative case that can be removed when one moves to a new home. The letter "shin," the first letter of the name Shaddai (one of God's many names) is written on the reverse side of the scroll such that it is visible from the back of the case. Why the name Shaddai? The most common explanation is that it is an acronym for "shomer daltot Yisrael" (Guardian of the doors of Israel). During the Middle Ages, some people viewed the mezuzah as a protective amulet and even added to it mystical names of God; however the sages inveighed against this belief and practice and eventually it faded away. Mezuzah cases are made of many different materials, including stone, ceramics, metal, and glass and there are many designs and decorative elements added; the most traditional, however, is the name "Shaddai" or the letter "shin" to represent that name. The mezuzah serves as a reminder of the commandments which obligate a Jew; these days it additionally serves to identify the house as a Jewish household.
The mezuzah should be affixed to the top third of the right side of the door tilted to face inward. Rashi ruled that the mezuzah should be affixed vertically; Rebbenu Tam ruled that it should be affixed horizontally. Therefore, as a compromise designed to express respect for both authorities, it is affixed diagonally, pointing inward to the house (Shulchan Arukh, YD 289:6); if the doorpost is insufficiently wide to accomodate the mezuzah diagonally, it is attached vertically. There is a custom to kiss the mezuzah upon entering the house by first kissing one's fingertips and then transferring the kiss to the mezuzah. Some recite the prayer "May God guard my going out and my coming in now and forever" as they kiss the mezuzah.
The mezuzah is affixed to every room of one's primary residence in which "living" takes places. This includes the kitchen, living room, bedrooms, home office, and playroom, but exempts the bathrooms.