Becoming a mayor in Foursquare is the simplest thing. You need to have visited a certain place the most number of times. In Foursquare terms this is known as a check-in. Therefore there is a simple formula to be applied, mayorships are based on the most days with check-ins in the past 60 days. So if you check-in more than once on the same day it is still calculated as 1x. Therefore to become mayor you will need to have the most number of check-ins. So if there is someone who has checked in more days that you, they get the title of mayor.
There is however a lot of freebies to help you on your way as many bars and cafes are now offering "Mayor Specials" like free coffees, discounts and other goodies. It therefore pays to be a mayor as you get a lot of free stuff. This of course is not guaranteed but there are goodies available in popular places.
(Hint: if you want to become mayor, you will need to have uploaded a profile photo to your account via your settings page)