In the Harry Potter books, professors of Hogwarts always seem to know what House their pupils are in. I don't see how professors can distinguish each of the students by their Houses, because I don't think they are ever given any sort of different attires or anything in the books. I suppose that the Heads of Houses might know what House their students are in, but I don't get how professors can tell every single student apart by their House. How do they do this?
They recognise them
Some detailed analysis at How many students attended Hogwarts? produces a final result of "we have no idea, blame JKR's bad maths", but it's somewhere on the order of a few hundred students. That seems a low enough number for professors to recognise them individually one by one.
Some teachers, like McGonagall and Snape, are Heads of Houses, so they'd be expected to know at least all of the students in their own House. But even for ordinary teachers without special administrative roles, it's not too much of a stretch to expect them to recognise all their students individually and know their names and which House they were in. People in such jobs in real life do that all the time.
The teachers do seem to know their students' names, at least most of the time, so surely they could easily remember a House affiliation as well as a name for each face in front of them.
It appears that part of the required uniform includes clothing items that will match the house colors such as a tie or blazer in those colors. According to the wiki article I found the item has changed over the years.
It also seems to be supported in Chamber of Secrets where after using the polyjuice potion they also took the uniforms to complete the look.
It could also be part of the name tag that is listed on the school supplies list that every first year student gets and is told to wear as part of the uniform.
It's a relatively small student population; the professors who have house affiliations (sort of the deans) probably have no trouble remembering everyone once they are in their 2nd or 3rd year. Also classe schedules are partially coordinated by house. And most likely some sort of identifying characteristic of the students' robes. I'm sure they have copies of the student rosters also lol.
Every teacher has a class roster, and the roster doubtlessly includes each student's house. Simply dealing with them day in and day out will be enough to learn the house of every student they regularly deal with.
When I was in the military, after nine months working in the orderly room, I knew the first name, last name, rank, and office extension of all 300+ people in my unit, and later when I taught ninth grade I learned the names of 150+ students in the first month. (I did have two sets of identical twins whom I could never tell apart.)
It's not hard to learn things like this.
Real life example: I attended a Canadian Forces military college. The cadets were divided into seven squadrons. In the first year, there were approximately 30 cadets per squadron for the main 6 (7th Squadron was a smaller one due to the building they lived in). It worked out to about 200 cadets in their first year. Then there were four more classes ahead of them (with fewer cadets in each), but still, several hundred. Being military, the uniforms were identical save for the small squadron flashes and position/rank insignia, so at a glance, even though the majority of the uniform was identical, you could tell what sqaudron someone was in, their year, and their position (rank, more or less). So it doesn't take much, at Hogwarts merely a small variation such as different ties or piping on the gowns would be more than sufficient.
Second thing, some uniforms, in civilian clothes, or PT gear, or college sports uniforms, there were no squadron insignia, but by the time a few months were in everyone in my class recognized what squadron another cadet belonged to simply by recognizing them. We might not remember their name, but we knew what squadron they belonged to.