In ancient times, it was probably more complicated and not uniform.
Later, poetry was introduced into the imperial examination, and later became a compulsory item in the imperial examination, and gradually produced a unified rhyme book to rhyme poetry.
The earliest rhyme book is Qieyun written by Lu Fayan in Sui Dynasty, which is divided into 206 rhymes. In the Tang dynasty, simplification was adapted into Tang rhyme, which was officially used as the standard for imperial examinations and literati's poetry writing until the Qing dynasty. So until 1949, the rhyme of poetry was based on the rhyme of the Tang Dynasty, regardless of dynasty and region, for thousands of years.
However, the rhyme book used later was Ping Shui Yun compiled by people in Song Dynasty. According to the rhyme of Tang Dynasty, the rhyme was combined into 107 rhyme. At the same time, the new rhyme of Pingshui written by Shanxi Pingshui Guanjin is 106 rhyme, and the rhyme of Pingshui was merged into 65436 rhyme in Peiwen Yunfu compiled during the reign of Kangxi in Qing Dynasty. At present, professionals still write poems according to Pingshui rhyme, not Chinese Pinyin.
Ping Shui Yun only merged and edited Tang Yun, but did not change the words. Therefore, from the Southern and Northern Dynasties to 1949, the poets' rhymes are consistent, and the subtle differences are almost negligible.