Yes when you run for mayor you are allowed to vote for others and for yourself as well.
Just like the president of the USA they can go into the voting places and vote for themselves to get to be president and so can a mayor who is running.
It doesn't seem right for a mayor or anyone to be able to vote for themselves but in the USA that is the persons right to vote for themselves.
The family that lives in the same town can also vote for the person to be mayor as well and the family of the person running for president of USA can vote for them as well.
If someone is running for mayor and they have a wife or adult kids that live in the same area then they will likely vote for them as well.