Sh’mira - the watching over of a deceased person’s body.
There is a belief that the soul remains near the body for some time after death, and must be comforted during this experience. It is also done to show respect, to show that their body is not considered an empty object to be discarded, but still a human being that must be respected, and so someone watches over them until it is time for taharah.
(TW: A bit gruesome) This custom is believed to have come from a time when it was common for Jewish bodies to be stolen and/or mutilated, and also due to the presence of rodents and insects that might eat the body. A member of the community or chevra kadisha was assigned to stay with the body in order to protect it. (end of gruesomeness)
Today, in many places, there is no longer a physical need to guard the deceased (for now,) but having a shomer/etz is still done out of respect.
From the moment of death, if possible, the body should never be left unattended. The shomer/etz must stay with the body at all times, including during Shabbat (bathroom breaks are allowed, though.) They may also recite prayers and Psalms in merit of the deceased. Anyone can act as shomerim, though some communities say women should only watch over women. While acting as shemor/etz, they are exempt from all religious duties and time-bound mitzvot. Like when performing taharah, men should tuck in their tzitzit when acting as shomer. Family members, if they wish, may serve as shomerim.
Eating, drinking, and smoking are forbidden in front of the deceased, though some communities do allow water to be drunk.
If there are multiple bodies, they should each be kept in a separate room if possible, with the shomer/etz continuously walking between rooms to recite prayers and Psalms.
The shomer/etz should not greet others or respond to greetings. In general, they should avoid speaking to others if possible. If something must be discussed, the shomer/etz should leave the room the body is being kept in and remain outside the door, with the door open. If the shomer/etz must leave the room for any reason, the door should again be left open.
Once relieved of their duties, the shomer/etz should wash their hands alternately three times. This should not be done in front of the deceased.