In any town with a lot of programmers (e.g. Bay area, NYC, Seattle, Boston,...) lots of people know each other and socialize. You'll go out drinking with your buddies and they'll say "company X just got a new contract - you to work with Alex at company Y didn't you? I'll bet if you called he'd be interested."