To get more specific than what I just outlined you just have to go through the town charters, and all of the changes to the charters, of each individual town. There are some strong similarities, because many towns copied the same charter. For example there were 29 different cities which adopted the Lübeck Law charter before the 15th Century. But each town went through it’s own pattern of when each specific right was won, or added to the charter, which was a process that may have taken 200 years or more. Many started out as more or less territorial towns and ended up Free or Free Imperial cities, then lost the rights again gradually in the Early Modern period.
As an example of such a source, you can read the charters of a few dozen Slovak towns here, mostly in Slovak, but you can use auto-translation.