What the milky one said.
IP based tracking, just like Google do so easily when it looks for results near you. Fairly crude since when I'm at home in Bury it thinks I'm in Bolton. But with Facebook it probably just keeps track of where you most often login.
It isn't a bad thing though, because when you log in from a very different location, like a different country, it makes you do some security checks before it lets you in. I had this when I was using Facebook in Abu Dhabi, it made me select from a list of people who were tagged in various photos so it could actually confirm it was me, I rather liked it.