Comparisons with coexistent languages we know the pronunciation of. The letters used in English for vowels weren't chosen randomly, they used the letters for the corresponding vowels in (Ecclesiastical) Latin. So by knowing that in Latin the a stood for a vowel similar to /a/, you can say the same of the a in English. This is again only approximate, as not all vowels match perfectly, and English has many more vowels than Latin ever did.
Spelling errors. In graffiti in Pompeii, occasionally the -t at the end of 3rd person singular verb forms isn't written, or the -m in female accusative nouns, which means they weren't pronounced. A future historian could learn a lot about modern English from phrases like "cuz", "tho", "would of", "I red a book", etc..
Known sound changes. All Germanic languages went through a process of i-umlaut, where the presence of an /i/ changed the quality of the vowel in the previous syllable. In German its effects are most clear (hence the name), but it left its marks on English. For example, the plural of mouse being mice. The contemporary vowels for those words, /aʊ/ and /aɪ/, are not related by umlaut, but /u/ and /y/ (with the /y/ changing into /i/ later) would fit.
Loanwords into other languages. If we know something about the phonological history of another language, a centuries old loanword can tell us something about how a word was pronounced. The Finnish word for "ring" is "rengas", which gives a hint that it must have been pronounced with an /e/ 2500 years ago.
All these "hints" and more are combined by linguists, and for some languages this means we have a very high confidence of their earlier phonology. Especially for Middle English, with its vast documentation, many sister languages, well-understood origins, relative recency etc..
Edit: Pretty much what edanm said. I really should do a page refresh before replying when the tab has been open for a while :)
And then, from hour to hour, we rot and rot / And thereby hangs a tale
Which is wittier when you realise that hour was pronounced like whore in his day.
If reasons were as plentiful as blackberries, where the prof explained it was a pun because "reasons" was pronounced more like "raisins" in 1597.
Eg for one example, if you know how one word is pronounced, and you have a poem that includes that word, you can follow rhymes.