How do I get my friend elected mayor?

Solution 1:

There are two ways you can do this. Probably easiest way would be to grant your friend a barony level city holding anywhere in your realm. If you don't have one in your demense already you'll need to obtain one. You can revoke the title, build a new city holding or gain it from conquest. Making him a mayor will turn him into burgher. When you grant him the county of Genoa, he'll remain a burgher making him the lord mayor of Genoa.

If that's not an option, another method would be to somehow acquire another holding in the county of Genoa, but in this case it can be of any type. It doesn't have to be city. To do this, you can build another holding, revoke a title or try to obtain a barony by inheritance. Once you have it, switch the county capital to that holding and then make your friend the mayor of city of Genoa. Grant him the county and he'll be lord mayor of Genoa.

To make your friend doge of a merchant republic you'll need to go one step further and grant him a duchy.

Solution 2:

Give your vassal the city title first, then give him the county title.

When you give a previously unlanded courtier a county, he becomes a noble-type ruler by default (a count). Only a character who is already a burgher-type ruler through obtaining a mayor-title will become a lord-mayor when obtaining a county.