Many cultures and religions have distinct traditional mourning rituals which help them deal with death. Mourning traditions often include common themes like observing a certain period of mourning before entering society, wearing modest or dark clothing, and saying prayers for the dead. If you are visiting a family in mourning who is from a different culture, you may want to look up their specific mourning rituals so that you do not inadvertently cause offense during a difficult time.
The first set of mourning rituals in many societies involves dealing with the body of the deceased. Many cultures encourage family members to wash the body and dress or shroud it for burial, although in some regions this task is delegated to a funeral director. For people who do deal with their dead directly, the act of bathing and dressing the body can be a very important act of mourning. Depending on cultural values, the body may be buried or cremated immediately after it is prepared, or the deceased may be put on display so that visitors can say their goodbyes.
In some cultures, the deceased must be buried before sundown on the day that he or she died, and ideally the deceased should be buried close to home. Many cultures also prescribe simple coffins and shrouds for their dead. Mourners who attend the burial typically wear dark, somber clothing, and they may bring gifts for the dead like flowers, artwork, letters, and so forth. Prayers for the dead are usually said while he or she is buried or cremated.
A set period of mourning is common to many mourning rituals. For example, people of the Jewish faith sit shiva for a week as part of their mourning process, and they traditionally tear or rip their clothing to symbolize their grief. People who do not sit in vigils may still observe a period of mourning in which they wear dark clothing or perform specific prayers for the dead; Buddhists, for example, have a set of prayers for the dead which are said at varying intervals after the deceased is cremated.
Because death is unavoidable, every culture has developed specific ways of dealing with death. Many mourning rituals have a religious basis, but some are also practical; many desert cultures, for example, require bodies to be buried immediately, as high temperatures can trigger rapid decomposition. Other cultures require widows to remain in mourning for nine months to ensure that when they remarry, paternity of any children will be clear.
Most mourning rituals are intended to celebrate the life of the deceased while also expressing sorrow at his or her passing. You are unlikely to offend mourners if you are respectful, but be aware that some cultures have very specific taboos surrounding certain flowers or funeral gifts; for example, flowers are not traditionally brought to people sitting shiva. Mourning rituals are so complex that it would take several volumes to describe them all, but a quick search in your favorite search engine can give you a quick course on mourning etiquette for a wide range of cultures and situations.