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:
On his turn, a player may place his mayor instead of a follower. He may only place his mayor in a city, which has no knight or follower. The usual follower placing rules apply. When a city is scored, the mayor counts for as many followers as there are pennants in the city. For example, if the city has 3 pennants, the mayor counts as 3 followers. If the city has no pennants, the mayor counts as no followers. A normal follower counts as 1 follower. The large follower from Inns & Cathedrals counts as 2 followers. The value of the city is not changed by the presence of a mayor. After scoring the city, the player takes his mayor back.