most ghosts come from a traumatic death, such as murder or a violent illness. Others stay because they are afraid of the other side, and still others stay to watch over family, so there is a choice involved. Not sure if there are specific guidelines though.
As for types of ghosts, I don't know if it's like the Sims where your appearance depending on how you die, but there are three types of hauntings, and thus three types of spirits.
1) Intelligent: These are the ones you can interact with, they acknowledge our presence and sometimes speak to us.
2) Non-intelligent: These spirits don't realize they are dead, and can't see us humans in their space. They just sort of drift around an afterimage of their former living space. They don't interact at all with us, and anytime they are heard, it is simply them going about their lives. A subtype of this is a sort of "energy footprint". This occurs when a highly charged event happens, and the location picks up that energy and sort of replays it when conditions are similar. A good example of this would be a woman who walks down the stairs, the dissapates, but it only occurs on calm fall nights.
3) These are nonhuman beings. They aren't technically ghosts, but they can haunt places and are spirits. They are the least common type.