When Fawkes the phoenix brings Harry the Sorting Hat in the Chamber of Secrets, the Hat produces a ruby-covered sword for Harry. Harry uses that sword to kill Slytherin's basilisk. The sword originally belonged to Godric Gryffindor. Harry's ability to draw it from the Hat to kill Slytherin's monster represents a fairly straightforward confrontation between good versus evil: Harry is on the side of one of the good founders of Hogwarts, not the pureblood-preferring bigoted one who eventually left the school.
At least, that's the black-and-white Slytherin-versus-Gryffindor story we're getting early on in the Harry Potter series. This equation of Gryffindor = good, Slytherin = bad becomes more problematic with the introduction of Peter Pettigrew in Book 3 and, of course, the revelation about another character (we don't want to spoil it!) in Book 7.
Tom Riddle's Diary
Tom Riddle's diary is not so much a symbol as a plot point. The diary gives J.K. Rowling an opportunity to bring Harry face to face with the young Voldemort, to start recognizing the similarities between the two, and to affirm his wish to walk a different path. What we like about the diary as a tool to achieve these goals is the way she presents this magical object.
Riddle describes the book as "a memory [...] Preserved in a diary for fifty years" (17.17). Yet he also talks about his possession of Ginny as an exchange of soul:
"So Ginny poured out her soul to me, and her soul happened to be exactly what I wanted [...] I grew powerful [...] Powerful enough to start feeding Miss Weasley a few of my secrets, to start pouring a little of my soul back into her." (17.45)
All of this talk of souls preserved in objects reminds us of something: the Horcruxes of Books 6 and 7. Even though Riddle's diary has a useful plot function in Chamber of Secrets, J.K. Rowling also uses it skillfully to foreshadow future developments about the state of Voldemort's soul and the secret to his continued life after getting hit by a reflected Killing Curse years before. We may not know that the diary is called a Horcrux by Book 2, but we do know that Voldemort has been leaving bits of his soul around – an important point to bear in mind as the series continues.
The Sorting Hat
The Sorting Hat places each new generation of Hogwarts first-year students into the four Hogwarts Houses. The Sorting Hat moves through your mind to decide if your primary characteristics are courage (Gryffindor), ambition (Slytherin), hard work and fair play (Hufflepuff), or intellect (Ravenclaw). So the Sorting Hat represents one quick way of characterizing all the Hogwarts students we ever meet: if you're a Ravenclaw, you're smart, if you're a Hufflepuff, you're patient, etc.
When an interviewer asked Rowling point blank, "Has the Sorting Hat ever been wrong?" Rowling said simply, "No" (source). We sort of can't imagine how that's possible – don't people ever change or outgrow their houses? – but we guess that's the point: it's magic.
J.K. Rowling has also confirmed that, when the Sorting Hat speaks to Hogwarts students, its words come "from the founders themselves" (source). So the Sorting Hat is the voice of Hogwarts; it is intimately tied to Hogwarts' history and origins. At the same time, the fact that the Sorting Hat is never wrong about people troubles us a bit, since weren't the founders of Hogwarts ever wrong? What about that whole Slytherin-versus-all-the-other-founders argument? Doesn't that cast doubt on the people who created the Sorting Hat in the first place?