A baraita on Berakhot 18b relates a story where a pious man sleeps in a cemetery and hears two spirits talking. One of them suggests they wander the world, and the other says she can't because she was buried in a reed mat (rather than a shroud). So these are spirits of people who once lived. This happens three years in a row, so it's not that the spirits are (for some reason) held there for the first year after death.
From what I understand of our tradition, it is not normal for spirits of the dead to hang around on earth. Why is it, then, that some do (according to this baraita, anyway)? Do spirits remain if there is some sort of unfinished business? If so, what qualifies?
One might think that the one is kept here because of an improper burial, but the other spirit doesn't seem to have trouble roaming, and so I infer was buried properly.