Say I'm living in Nowhereville, USA, and working for the tech company there. If anything goes wrong, for example, an overall tech downturn, this company hits hard times, or I have a job-ending disagreement with my boss, then getting a new job likely means a 6+ month job search, uprooting my family and moving. I know this is true because I have lived in several towns like this. It sucks.
In the Bay Area, if things don't work out with a particular company, I can apply to hundreds of others next door. I'm in for a 3-6 month job search, and at the end of the day I don't have the hassle of moving to a different city.