Your mayor affects research or building only at the time you initiate it. So when you click the button to research “archery level 9” you want to have your high intelligence hero as mayor. As soon as you start the research change back to your high politics mayor so that you collect resources faster and shorten build times for structures. If you change your mayor while the research is happening you won’t get any bonus!
When building structures you want to have your high Politics hero as mayor WHEN you click on the button to upgrade the building. As soon as you have clicked that button you can switch to a different hero.
Make sense? If not leave a comment and let me know!