MACBETH. Life's but a walking shadow, a poor player
That struts and frets his hour upon the stage
And then is heard no more.
(act 5, scene 5, lines 26–28)
Macbeth, written about 1605, is the last of Shakespeare's plays in which this theme of players on a world stage appears. Shakespeare's first reference to the world as a stage occurs in The Merchant of Venice, written about 1596–1597.
ANTONIO. I hold the world but as the world, Gratiano;
A stage, where every man must play a part,
And mine a sad one.
GRATIANO. Let me play the fool!
(act 1, scene 1, lines 80–83)
The most famous reference to this theme is Jaques's "all the world's a stage" speech, also known as the "seven ages of man" speech, in As You Like It.
JAQUES. All the world's a stage,
And all the men and women merely players;
They have their exits and their entrances;
And one man in his time plays many parts.
(act 2, scene 7, lines 146–149)
Jaques describes each of the the player's "exits and entrances," until the player's final scene, after which the player is heard no more.
JAQUES. Last scene of all,
That ends this strange eventful history,
Is second childishness and mere oblivion.
(act 2, scene 7, lines 170–172)
This is a recurring theme to which passing reference is made in King Henry IV, Part 2, written in 1597:
Let order die!
And let this world no longer be a stage
To feed contention in a ling'ring act.
(act 1, scene 1, lines 170–172)
This reference is also made in King Lear, written in 1605–1606: "When we are born, we cry that we are come / To this great stage of fools" (act 4, scene 6, lines 197–198).
Macbeth's speech in which he says that "Life's but a walking shadow" isn't the first time that the theme of players on the world stage is mentioned in Macbeth.
ROSS. Ah, good father,
Thou seest the heavens, as troubled with man's act,
Threaten his bloody stage.
(act 2, scene 4, lines 5–7)
Macbeth also talks about playing "the humble host" at his coronation banquet, at which the ghost of Banquo appears uninvited, and playing "the Roman fool, and die / On mine own sword?" a reference to the deaths of Brutus and Cassius in Julius Caesar that Macbeth makes shortly before his own death.
MACBETH. It is a tale
Told by an idiot, full of sound and fury,
(act 5, scene 5, lines 28–30)
With the death of Lady Macbeth, Macbeth is utterly alone in the world, and he's alone on the stage on which, until recently, he played the major role of king of Scotland.
At this point in the play, Macbeth is confused, disheartened, and disillusioned. He's also in disbelief that all of this is truly happening to him. Macbeth comes to the realization that everything he's done, all of the strutting and fretting and the part he played in the "sound and fury" that made and kept him king, is essentially meaningless.