How do you score the Mayor in an unfinished city at the end of a game of Carcassonne?
The Mayor's ability allows him to count as more than one follower. So at the end of the game, an unfinished city is scored as normal - compare the Mayor's effective follower number with that of any other player present in the city. The player(s) with the most followers each score one point per city tile, and one point for each pennant.
The only special case is that if the city has no pennants, then the Mayor doesn't count as a follower, and can't score anything.
Here are the relevant rules: