At the end of the play, Macbeth comes to his just reward. Just as he killed the traitor Macdonwald and stuck his head on a pike as the play opened, so Macduff beheads Macbeth for his treacherous act of killing Duncan and seizing the throne.
Killing the king set Macbeth on a murderous path that included having his friend Banquo murdered, along with Macduff's wife and children. More importantly, becoming king was not the nirvana Macbeth expected. Seizing the throne led Macbeth to be constantly suspicious of everyone around him. It destroyed his relationship with his wife. Even before he died, he was dead inside, his life a misery.
At the end of the play, with his wife dead by suicide and nothing else to lean on, Macbeth grasps at straws for hope, believing in the witches' treacherous prophecies.
The play leaves audiences with a sense of closure and satisfaction. Crime is punished and order restored to Scotland when the rightful heir, Malcolm, takes the throne. Calling him the kingdom's "pearl," Macduff cries of Malcolm, Macbeth's head in his hand:
Hail, King of Scotland!
Just as Duncan rewarded those who fought for him against traitors who threatened Scotland, so Malcolm does the same, naming his supporters "earls."
While a satisfying conclusion, in which good triumphs over evil, the end of the play is so close to the beginning that it also leaves us with the uneasy feeling that yet another traitor might be lurking in the wings.