The study of the immune system, including how it works, the cells involved, and how it responds to pathogens.