I know the reasons why Bruce doesn’t run for mayor, but has there ever been a story (Canon or Elseworlds) where Bruce tried to run for mayor or even just talk about it with another character?
Not really sure. I know Barbara Gordon used to be some form of government official (maybe Congresswoman?) but I don’t think there’s ever been a time that Bruce ever ran for public office. In NML he addresses Congress in hopes of convincing the US not to turn their back on Gotham, and I’m pretty sure that’s the extent of his involvement in government.
Batman #300, a possible future story, ends with Bruce contemplating retirement and a run for governor, but it doesn’t reveal whether he goes through with it.
I believe - if I remember the story correctly - that Bruce Wayne was a US Senator for one vote in The Brave and the Bold #85 (with Green Arrow) back in 1969.
Batman is referenced as president in Elseworlds Superman/Woner Woman whom Gods destroy #1. Not Mayor but close.