system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: why do some vaccines confer life long immunity while others just a few years?
gpt
Vaccines work by presenting an inactive version/element of a disease causing agent (antigen) to the patients immune system, allowing their immune system to develop antibodies against said antigen. This is analogous to police posting wanted posters of a criminal's face around a town the criminal is likely to hit. The people in the town will know what he looks like and will be able to respond appropriately if they see him. 

Microbes, however, will evolve over time at different rates (the flu virus evolves quickly as it passes quickly from host to host but other viruses, such as HIV, evolve more slowly). Sometimes microbes will evolve so much that the antibodies in a person's body can no longer accurately detect and fend off their assault. This is like the criminal in the above example receiving some type of cosmetic surgery to change his appearance. Now the townsfolk won't recognize him and he'll be free to steal their women and rape their cattle.