In Shakespeare's Julius Caesar, the Ghost is a bad omen for Brutus. Brutus betrayed Caesar by taking part in the conspiracy against him and helping to assassinate him. In a play that involves numerous omens (see Act I.3, for instance), this one has a specific target. Whereas other omens reflect the unnatural state of political upheaval in Rome, this omen directly suggests that Brutus is about to take a fall, and Caesar is about to be avenged.
If the deceased Caesar is at Philippi in the form of the Ghost, as the Ghost says he will be, that suggests the battle that will take place there will not go well for Brutus. Brutus is about to "get his" for what he did to Caesar.
The Ghost, then, serves as foreshadowing of what's to come by presenting an omen that reveals that the plot is about to come full circle. Brutus will fall because of his poor decision-making and his poor judgment of others, such as Cassius. He will fall because of his part in Caesar's assassination.
The Ghost sets the mood for the remainder of the play. Brutus is doomed. He and Cassius both know it, or at least suspect it. The appearance of the supernatural gives an air of fate or destiny to what follows.
Shakespeare, as other Elizabethan writers, uses the idea of ghosts in his plays usually as a foreshadowing of events to come. In "Hamlet," Hamlet has to deal with working out what to do with his father's request for revenge, and also, whether the ghost is indeed his father. In "Macbeth", Macbeth has to deal with the Ghost of Banquo showing up to dinner, literally haunting him. In "Richard III", Richard deals with the ghosts of the men he has wronged right at the start of the play.
This haunting is significant also in "Julius Caesar". The Ghost of Julius arrives on the eve of battle to literally haunt Brutus. Brutus had hoped that by killing Caesar he would enact change in Rome, however, the Roman Empire goes on, as does the reign of Caesar (albeit, a new Caesar).
As Brutus goes into battle, and the battle doesn't go his way, he again turns to Julius Caesar, blaming him for the outcome of the battle,
O Julius Caesar, thou art mighty yet!
Thy spirit walks abroad, and turns our swords
In our own proper entrails. (5.3.94–96)
Shakespeare's ghosts are visible to one person (as well as the audience, clearly) so those who react to the ghost are the ones who are supposed to learn from the arrival of the ghost, heeding the message from beyond the grave.
Enter the Ghost of CAESARHow ill this taper burns! Ha! who comes here?
I think it is the weakness of mine eyes
That shapes this monstrous apparition.
It comes upon me. Art thou any thing?
Art thou some god, some angel, or some devil,
That makest my blood cold and my hair to stare?
Speak to me what thou art.
GHOSTThy evil spirit, Brutus.
BRUTUSWhy comest thou?
GHOSTTo tell thee thou shalt see me at Philippi.
BRUTUSWell; then I shall see thee again?
GHOSTAy, at Philippi.
BRUTUSWhy, I will see thee at Philippi, then.
Looking at the entire interaction, Brutus first of all questions who the ghost is, but as soon as the ghost calls him an evil spirit, he knows who it is. The ghost of Julius Caesar answers his question twice, that he will see him at Phillippi.
Brutus is now aware that death awaits him at Phillippi, and on the other side, Julius Caesar is also awaiting Brutus for his actions. The haunting of Brutus sets up his eventual demise, foreshadowing to the audience and reader alike that the end is nigh for him, allowing the tragic element to come full circle. When the ghost again appears on the battlefield, Brutus accepts his demise and becomes a tragic hero, urging the ghost of Caesar to be at peace as Brutus takes his own life.
Runs on his sword
Caesar, now be still:
I kill'd not thee with half so good a will.