I've been thinking about the idea that the Sorting Hat would want to distribute the first years fairly evenly across the four houses...
I'm wondering if the Hat has an idea, before the Sorting Ceremony, of whom it's going to put where? Sort of how NPC sororities at some schools have a good idea, before round 1 of formal rush even starts, of whom they're going to invite to round 2, just based on their resumes and reputations.
Then, if the Hat sees something during the ceremony, it can make adjustments - like placing Harry in Gryffindor with his friends instead of in Slytherin.
Remember that the Hat didn't even need to touch Draco's head to decide that he was a Slytherin.
If the Hat had no idea what the first years were like before the ceremony, things could go awry. Say a class of particularly intelligent first years comes through - then Ravenclaw might end up with an unusually large class. (Bid matching gone horribly, horribly wrong

)