When a pathogen invades the body, the immune system mounts an immediate response by activating various immune cells. During this process, some B and T cells become specialized memory cells. Memory B cells can rapidly produce antibodies upon re-exposure to the same pathogen, while memory T cells can quickly recognize and kill infected cells. This is the essence of how vaccination works, mimicking natural infection to establish immunity without causing disease.