The Sorting Hat announced the House the student was to join.
At the beginning of each school year, the magical Sorting Hat was placed on each new student's head during the Sorting Ceremony. When the founders worried how students would be selected after their deaths, Godric Gryffindor took his hat off and each 'put some brains' in it, creating the Sorting Hat to choose future students for each House. In the early days of Hogwarts, the four founders handpicked students for their Houses. These two competitions bred rivalries between the Houses, the greatest of which was that between Gryffindor and Slytherin. Each House also had its own Quidditch team that competed for the Inter-House Quidditch Cup. The House with the most points won the House Cup. The houses competed throughout the school year, by earning and losing points for behaviour. Each year's group of students in the same House shared the same dormitory and many classes.
Houses at Hogwarts were both the living and learning communities for its students.