Linguistics is the formal study of language. Included under that general definition are such areas as tracing the history of a language and its development, how words developed and how meanings have changed over time, and the interpretation of phrases.
Since Shakespeare wrote Hamlet over 400 years ago, the English language has changed and evolved, as all languages do over time. Linguists can learn about how the language has evolved by "translating" passages from the play to contemporary language.
For example, Shakespeare's original text in Hamlet's monologue reads,
O, that this too too sullied flesh would melt,
Thaw and resolve itself into a dew,
Or that the Everlasting had not fix'd
His canon 'gainst self-slaughter!
In modern English, this same section would be
O that my too, too solid body would melt,
Thaw, and change itself into a dew!
Or that the Everlasting God has forbidden
Use of "suicide" instead of "self-slaughter;" how, why, and when the change of terms occurred - those are the kinds of insights into the English language that linguists study.