Lots of humans. Lots of companies. Random chance.
Of course, its not that simple. Some companies probably are great at scouting. Yegge mentioned a few ways in the post. Good internship programs, acquihiring, etc.