How does the immune system function to protect the body from pathogens and foreign invaders? What are the key components and mechanisms involved in the immune response?