The ghost of Hamlet's father appears twice in Act I and once in Act III. Each appearance increases his power. When skeptical Horatio perceives him "like the King," he gives the ghost some credibilty.
After learning about invasion by the army of Fortinbras, combined with some other current events, Horatio concludes that the ghost has an urgent matter, and asks him to speak if he is "privy to thy country's fate..." Horatio thinks the ghost may have appeared since he has "extorted treasure/For which....spirits oft walk in death..." and not to inform him. The ghost fades, leaving Horatio doubting his purpose. Intuitively, though, Horatio thinks that the ghost will speak to Hamlet, so the ghost's position is strengthened some.
When Hamlet learns of the ghost he is open to its existence, but cautious when beckoned. Doubt is dispelled when the ghost gives Hamlet details of his death saying he must walk the earth until the "foul crimes...Are burnt and purg'd away." Hamlet believes and swears his friends to secrecy as the ghost, under the stage, commands them by Hamlet's sword. He is now active.
In A. II, sc. iv, the ghost reappears and talks to Hamlet while the Queen cannot see or hear him, thus establishing her involvement in evil.
The ghost's not appearing at the end of the play creates an ambiguity that leaves the reader to wonder if the ghost's role is to prick the spirit of the melancholy Hamlet into action for him.
The first appearance of the ghost in the play occurs when Marcellus and Bernardo bring Horatio to their watch to see the ghost.They have seen the ghost two times before the play opens and want to see if the ghost will speak to Horatio and if Horatio will confirm that the ghost is that of Hamlet's father. The ghost appears and Horatio confirms it looks like the ghost of Hamlet's father but the ghost will not speak. Horatio then tells the guards they must tell Hamlet for surely the ghost will speak to him. The second appearance occurs when Hamlet is with Horatio, Marcellus and Bernardo. It beckons Hamlet to follow him but Horatio warns Hamlet not to follow. Hamlet follows anyway and this time the ghost speaks. The ghost reveals that he is the spirit of Hamlet's father and that he was murdered by Hamlet's uncle, Claudius. The ghost begs Hamlet to take revenge on Claudius, but not to harm his mother. It then disappears visually but is heard telling Marcellus and Horatio to swear that they will never reveal the ghost's appearance. The third time the ghost appears, Hamlet is arguing with his mother. He is getting abusive and violent with her. The ghost appears and tells Hamlet to be gentle with his mother and not to harm her. Gertrude, Hamlet's mother, thinks her son is crazy because she sees nothing. The ghost disappears into the night and that is the last time he is seen in the play.