Hamlet was written around the year 1600 in the final years of the reign of Queen Elizabeth I, who had been the monarch of England for more than forty years and was then in her late sixties. The prospect of Elizabeth’s death and the question of who would succeed her was a subject of grave anxiety at the time, since Elizabeth had no children, and the only person with a legitimate royal claim, James of Scotland, was the son of Mary, Queen of Scots, and therefore represented a political faction to which Elizabeth was opposed. (When Elizabeth died in 1603, James did inherit the throne, becoming King James I.)
It is no surprise, then, that many of Shakespeare’s plays from this period, including Hamlet, concern transfers of power from one monarch to the next. These plays focus particularly on the uncertainties, betrayals, and upheavals that accompany such shifts in power, and the general sense of anxiety and fear that surround them. The situation Shakespeare presents at the beginning of Hamlet is that a strong and beloved king has died, and the throne has been inherited not by his son, as we might expect, but by his brother. Still grieving the old king, no one knows yet what to expect from the new one, and the guards outside the castle are fearful and suspicious.