Is there a formula that can get sunrise at a particular latitude and longitude (and elevation from sea level)? If so, what it is? (Why does it work?)
The sunrise equation is what you're looking for. This gives the number of hours of daylight as a function of your latitude and the Sun's declination; the declination is itself a function of the day of the year.
From that one could figure out the time of sunrise (using the longitude and time zone for correcting for the position in the time zone), assuming that noon is exactly halfway between sunrise and sunset.
But ignoring time zones and daylight savings time, the time halfway between sunrise and sunset is not noon! On average it's noon, but sometimes the sun runs slow and sometimes it runs fast. The correction for this is called the "equation of time"; the Wikipedia article gives an approximate formula good to within 45 seconds.