Many readers have questioned why Shakespeare's play should be called Julius Caesar when Caesar dies halfway through his play and the real tragic hero seems to be Brutus. Shakespeare was aware of that problem, and he seems to be trying to show in various ways that Caesar may have been dead but his spirit and indomitable will prevailed until the end. One of the ways Shakespeare reminds the audience of the spiritual presence of Julius Caesar after his death is by borrowing from Plutarch and dramatizing the scene in which Caesar's ghost appears to Brutus in his tent before the battle of Philippi.
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.
Thy evil spirit, Brutus.
Why comest thou?
To tell thee thou shalt see me at Philippi.
Well, then I shall see thee again?
Ay, at Philippi.
Why, I will see thee at Philippi then.
[Exit Ghost.] IV.3
At the end of the play, both Brutus and Cassius state that Caesar was instrumental in their defeat at Philippi. When Brutus commits suicide by running on his sword in Act V, Scene 5, his dying words are:
Caesar, now be still;
I kill'd not thee with half so good a will.
Earlier, in Act V, Scene 3, when Cassius commits suicide by having Pindarus stab him, Cassius' last words are:
Caesar, thou art revenged,
Even with the sword that kill'd thee.
In that same scene Brutus comments:
O Julius Caesar, thou art mighty yet!
Thy spirit walks abroad, and turns our swords
In our own proper entrails.
All of this is to maintain the thesis that this play is about Julius Caesar and that he is still present in spirit even though he may have been assassinated in Act III, Scene 1, approximately the middle of the text. When Antony is speaking over Caesar's body in Act III, Scene 1, he predicts that Caesar will come back from hell.
And Caesar's spirit, ranging for revenge,
With Ate by his side come hot from hell,
Shall in these confines with a monarch's voice
Cry "havoc!" and let slip the dogs of war.
So the role of Caesar's ghost in the play is to demonstrate that Caesar is still very much present and influential in political and military affairs even though he may be dead. He is such a powerful person that even death cannot stop him from enforcing his will. He may not become a king himself, but his successor Octavius becomes an emperor and a god, and Caesar initiates a whole line of Roman rulers who use his name as a mark of highest honor.
From a practical standpoint, Shakespeare gets some extra work and additional exposure out of the actor who plays Julius Caesar. Shakespeare does something very similar with Banquo in Macbeth. Although the actor playing Banquo is seen being murdered in Act III, Scene 3, he reappears as a ghost at the coronation banquet in Act III, Scene 4 to horrify Macbeth and assert his presence as his murderer's nemesis. The actor playing Hamlet's father's ghost makes a reappearance in Queen Gertrude's bedroom in Act III, Scene 4 of that play. Shakespeare obviously liked using ghosts for stage effects.