Just like other human beings, academics will tend to remember students who they have had regular one-on-one contact with over a sustained period of time. They are unlikely to remember students who they have met only in group settings (e.g., in lectures, etc.) or only on sporadic occasions. The passage of time will also tend to eradicate memories of particular students, unless they were well-known. And as with all other people, the memory of academics is affected by the length of contact, volume of other contacts with students at around the same time, time since last contact, and the idiosyncracies of memory of each individual.
So just curious: do professors remember all their ...
Usually, but not always - Collaboration on a research project generally involves sustained contact, though it can also involve remote contact (via email, etc.) with some collaborators that you do not meet face-to-face very often, or at all. Some research projects might involve large teams, and in this case an academic might forget some members of the team. Academics will generally remember most or all of their research collaborators if they work closely in small groups, but might forget some who they did not meet often, or those on large teams.
Yes - Supervising a postdoc involves regular one-on-one contact over a period of several years. It involves assessment of work, research collaboration, and supervisory feedback. It is a close working relationship that would generally be retained in memory for a substantial period of time.
Yes - As with a postdoc, supervising a postdoc student involves regular one-on-one contact over a period of several years. PhD students require more guidance than postdocs, so the relationship usually involves even more contact. It involves assessment of work, research collaboration, and supervisory feedback. It is a close working relationship that would generally be retained in memory for a substantial period of time.
Undergraduate research students?
Maybe - Undergraduate research projects involve talented undergraduate students (the type you might remember) but they are usually short and simple research projects (which are fairly forgettable). Contact with the student is usually for only one or two semesters. After a period of time you might forget these students.
Undergraduate non-research students (i.e. those who took one of their classes)?
Definitely not - There are hundreds/thousands of them. Some academics teach courses with several hundred undergraduate students each semester, in which case there are thousands of them over a period of years. You might be lucky to remember a few of the students that did particularly well in your courses, or had a lot of contact with you. For the rest of them, you would probably recognise the faces for a year or two afterwards, but eventually even this would fade and you would not recognise them at all.
It depends - This really depends on what exactly is being taught for these summer students. If they are just taking summer classes then there is a similar dynamic to other undergraduate students, although the classes are probably smaller, which aids memory retention. If they are doing research projects over the summer then the dynamic is similar to undergraduate research students.