What is the meaning of [He who laughs last laughs longest]

This proverb originated in Tudor England but, for once, wasn’t coined by Shakespeare. It is found in print in the play Christmas Prince, which was first performed, at Cambridge, around 1608:

Laugh on laugh on my freind
Hee laugheth best that laugheth to the end