If the mayor would by lynched during the day, they reveal that they are the mayor and nobody is lynched that day. A mayor that has previously been revealed will be lynched as normal. Roles seen as villager and win stealers (such as fool, monster, jester, and werekitten) cannot be the mayor. The mayor does not know that they are the mayor until they are lynched.
The restrictions on which roles are ineligible to be mayor are defined using Role categories: All - Innocent - Win_Stealer
Appearances in game modes