The concept in many religion
s that the dead
who have either died a violent death
or have somehow lead an incomplete
life, such as virgin
s or women
who die in childbirth, cannot fully partake of the afterlife
until the breach in social order
is restored. They thus remain in liminal
space, neither on earth nor in the underworld
, and so are magically useful
In rare instances, the dead can punish the offender themselves; Aztec religion holds that the spirits of women dying while giving birth are first to be honoured, then warded off with apotropaic ritual. Murdered spirits are often impotent to act themselves, and seek recourse to a deity who guards social order and punishes transgression, such as the Greek Hecate. This is one interpretation of the myth of Seth and Osiris, with whom on Egyptian-influenced curse tablets the dead are often associated.
There's probably some big anthropological theory involved here, involving taboo and purity and danger and somesuch nonsense, but that's the gist of it.