here is the song the sorting hat sings in "sorcerer's stone":
"oh, you may not think I'm pretty,
but don't judge on what you see,
i'll eat myself if you can find
a smarter hat than me.
you can keep your bowlers black,
your top hats sleek and tall,
for I'm the hogwarts sorting hat
and I can cap them all.
there's nothing hidden in your head
the sorting hat can't see,
so try me on and I will tell you
where you ought to be.
you might belong in griffindor,
where dwell the brave at heart,
their daring, nerve, and chivalry
set griffindors apart;
you might belong in hufflepuff,
where they are just and loyal,
those patient hufflepuffs are true
and unafraid of toil;
or yet in wise old ravenclaw,
if you're a ready mind,
where those of wit and learning,
will always find their kind;
or perhaps in slytherin
you'll make your real friends,
those cunning folk use any means
to achieve their ends.
so put me on! don't be afraid!
and don't get in a flap!
you're in safe hands (though I have none)
for i'm a thinking cap!"
this basically sums up the process of sorting :D
coming soon, the sorting hat's song in "goblet of fire"