As far as i can see, once it made the jump from settlement to town (so inclusion of a church, also both towns and cities have mayors) their is no set way with possibilities including a vote by all adult (and presumably white) males or even just the general assent of the people in a town meeting in less 'civilised' parts.
Also mayors could be strong or relatively weak depending on a host of factors.
.