Sorting Hat

The Sorting Hat is an artificially intelligent hat residing in Hogwarts as of January 1993.

Origins
The Sorting Hat was created by the Hogwarts Founders using what the Hat describes as "a unique blend of Pensieve magics, Legilimency and an ordinary but fashionable cloth hat". The Hat was given part of the memories and personality of each Founder (which included Salazar Slytherin's knowledge of Parseltongue) and the ability to read students' minds, so as to be able to determine which House would suit them best.

Each year from then on, the Hat was ceremoniously placed on the head of each first-year student who came to Hogwarts during what is known as the Sorting Ceremony. The Hat also took to introducing the four houses and their associated qualities in the form of a song before the Ceremony.

17th century
In the 17th century, the Sorting Hat Sorted Roderick Ollivander, great-great-great-uncle of Garrick Ollivander, and became "rather good friends" with him.

1991-1992
In 1991, during the Sorting, the Hat met Hermione Granger and started chatting with her, finding her to be a brilliant conversationalist. Much later in the school year, Hermione and Harry infiltrated the Headmaster's Office to talk with the Hat, presuming the Evil Turban was similar to him and thus seeking his advice. The Hat shot down this theory, as he remembered Tom Riddle had once been a student, but he informed them of the nature of what was hidden in the Third Floor Corridor — the Philosopher's Stone — which he knew from Professor Dumbledore and the other Heads of House having discussed it in his presence.

1992-1993
In september 1992, the Hat Sorted Luna Lovegood, and the combination of the Hat's gossip tendancies and Luna's dreaminess made their conversation go on and on for more than ten minutes until Professor McGonagall finally reminded the Hat he was supposed to be sorting the girl.

In January 1993, the Sorting Hat was asked by Professor Dumbledore and his friend Hermione Granger to Sort new, highly unusual student Maximilian Candy in private — the "boy" actually being a Boggart who had gained sentience. The Hat seemed to disagree with Maximilian on what House would suit him best, but eventually relented and let him join Hermione in Gryffindor.

In February, Sirius Black sneaked into the Headmaster's Office through a secret passage, seeking the Marauder's Map, which he supposed Professor Dumbledore had gotten his hands on back in the day following Argus Filch's confiscation thereof. Not finding it, Sirius, knowing the Hat was unable to reveal what he saw in the minds of the people he Sorted, put the Hat on to ask him if he'd seen Dumbledore handling the map. The Hat said no and Sirius fled.

Following this incident, Dumbledore, who had learned of Sirius's visit from the Headmaster Portraits, called for Hermione Granger to use her talent at finding loopholes to get the Sorting Hat to tell them what he knew about Black. Hermione succeeded and the Hat explained what he had learned.

Personality
The Sorting Hat is very wise and experienced, having held his role for a full thousand years. However, he also has a kookier edge, and likes long-winded conversation. Moreover, the Hat often wishes to be recognized as a person and have his opinion asked for, which Professors and students alike do only too rarely.