How did Chinese people know in the past the pronunciation of words?
The pronunciation of characters was glossed using the Fanqie (反切) system, which uses two existing characters whose pronunciations are known to determine the pronunciation of the unknown character.

Suppose that I wanted to know the pronunciation of「東」. Looking this character up, I'd see that it was phonologically glossed in dictionaries as 德紅切, which means to take the onset (basically the initial consonant) of the first character, in this case「德」, and the "final" (which really is everything after the onset) of the second character, in this case「紅」. In Pinyin,「東」is dong, and reconstructing this syllable with the fanqie system we'd get the initial of「德」(Pinyin de) and everything after the onset of「紅」(Pinyin hong) to get dong.

Note, fanqie dictionaries were compiled by scholars in consideration of all the varieties of Chinese, not favouring any particular topolect, which means that they work equally well for all these varieties. In addition, they also work for Sinoxenic pronunciations of Chinese-originated vocabulary in Japanese, Korean, and Vietnamese. This is possible because the two characters used to construct the pronunciation are not phonetic symbols like alphabet letters, but have their own unique pronunciation in all the varieties of Chinese (as well as Japanese, Korean, and Vietnamese, due to centuries bordering on millenia of cultural and language diffusion across East Asia). The caveat is that the phonology guide is a good approximation but not always an exact match, as the sound evolution of the different varieties of Chinese from the ancestral language is not always consistent everywhere.

This requires the reader to be somewhat literate already, of course - but then again, which dictionary in any language doesn't?



Demonstration that it is a good approximation for other languages which have used Chinese characters:

東, 德紅切:


Japanese: 東 (tō), 德 (toku) 紅 (kō)
Korean: 東 (dong), 德 (deok) 紅 (hong)
Vietnamese: 東 (đông), 德 (đức) 紅 (hồng)