What art thou that usurp’st this time of night
Together with that fair and warlike form
In which the majesty of buried Denmark
Did sometimes march? By heaven, I charge thee, speak. (I.i.44–47)

The play opens with a ghostly encounter in the dead of night outside the castle in Elsinore. In these lines, Horatio accuses the Ghost of usurping the night (to usurp is to seize power illegitimately) and demands to know why the ghost looks just like the late King Hamlet. Although the ghost quickly leaves without answering, this mysterious encounter sets an ominous tone and establishes the world of the play as one in which supernatural beings can interact with the living. 

At least, the whisper goes so: our last king,
Whose image even but now appeared to us,
Was, as you know, by Fortinbras of Norway,
Thereto pricked on by a most emulate pride,
Dared to the combat; in which our valiant Hamlet
(For so this side of our known world esteemed him)
Did slay this Fortinbras, who by a sealed compact
Well ratified by law and heraldry,
Did forfeit, with his life, all those his lands. . .
             Now, sir, young Fortinbras,
Of unimprovèd mettle hot and full,
Hath in the skirts of Norway here and there
Sharked up a list of lawless resolutes. . .
But to recover of us, by strong hand
And terms compulsatory, those foresaid lands
So by his father lost. And this, I take it,
Is the main motive of our preparations,
The source of this our watch, and the chief head
Of this posthaste and rummage in the land. (I.i.79–88; 94–96; 101–106)

In these lines from the opening scene, Horatio explains that Denmark is preparing for an imminent invasion from Norway, which is why the castle at Elsinore is so heavily guarded. Sometime in the past, the late King Hamlet had killed King Fortinbras of Norway and seized his lands. Young Fortinbras, his son, is now gathering an army to Denmark to take back the lands his father lost. Ironically, the threat of invasion plays little to no role in the tragic events of the play, mainly because the royal court at Elsinore is preoccupied with internal corruption and treachery. By the time Fortinbras appears with his army in the play’s final scene, the Danes have already managed to bring about their own demise. 

What if [the ghost] tempt you toward the flood, my lord,
Or to the dreadful summit of the cliff
That beetles o'er his base into the sea,
And there assume some other horrible form,
Which might deprive your sovereignty of reason
And draw you into madness? Think of it.
The very place puts toys of desperation,
Without more motive, into every brain
That looks so many fathoms to the sea
And hears it roar beneath (I.iv.72–81)

As Horatio begs Hamlet not to follow the Ghost, he characterizes the castle at Elsinore as a place that naturally inspires suicidal thoughts. The castle sits perched on a cliff that overlooks the roaring sea far below. Horatio claims that anyone who looks down at the sea in a moment of desperation might be tempted to jump. His words prove prophetic, as Hamlet later contemplates suicide as a way to escape his troubles.

Something is rotten in the state of Denmark. (I.iv.95)

In this line from Act I, Marcellus quips that something in Denmark is rotten, a metaphor that invokes images of decay and corruption. Marcellus speaks this line just after the Ghost lures Hamlet away to talk to him. At this point in the play, the audience already knows about Gertrude’s hasty remarriage to Claudius, her late husband’s brother, but they will soon learn the even more rotten truth about how Old Hamlet died. As the play progresses, the pomp and circumstance of Denmark’s royal court proves to be a thin veneer for its underlying corruption.