Why you need vaccine boosters for some diseases and not others — as New York records first measles death in 30 years

Why do some vaccines need boosters while others last a lifetime?