In "Hamlet" when the ghost appears, Horatio confronts it. What are the three traditional reasons for a ghost's appearance?
The first one that is mentioned is that it is a bad omen, that some ill-luck is going to befall the country. Horatio says of it that it "bodes some strange eruption to our state" (I.i.69). He mentions later that before Rome fell many witnessed ghosts, so Horatio is worried that Denmark's recent acquisition of Fortinbras' lands might have prompted return warfare, and the king's ghost is the one who is warning them of it.
The second reason that is mentioned is that he has a buried treasure of money somewhere, and his ghost has come back to seek it. Upon the second visit of the ghost the first scene we see it, Horatio confronts it, asking, "if thou hast uphoarded in thy life extorted treasure in the womb of earth, for which, they say, you spirits oft walk in death" I.i.136-138). Apparently it is a well-spoken of bit of rumor or superstition that says ghosts return to seek after treasure hoarded during their lifetime.
The last of the discussion focuses on how the ghost seemed to startle when the rooster crowed the coming dawn. They discuss how evil spirits cannot be around at the break of day, because that is when the Savior is born, so good and evil cannot mingle. So the third possible reason is that it is an evil spirit come to do harm; Hamlet himself worries about this for the rest of the play, until his suspicions regarding Claudius are confirmed.