One day the next town over has an outbreak of Nashococcal. One elderly man even died. Along comes a fat, red-faced doctor and starts offering a Nashococcal vaccine. "There is, however, a chance of swelling around the jab site and you will most definitely feel dizzy for twenty-six minutes afterward," says the doctor.
Do you take the vaccine? Of course! Dizziness for half an hour is much better than risking serious illness and possible death. By the same logic, almost everyone gets vaccinated. The doctor's double chin quivers slightly with worry as he recommends his vaccine: "Especially for old folk, children and others whose health is generally at risk."
There is, however, one family of right-wing, climate-change-denying, homeschooling UFO-worshipers that chooses not to be vaccinated. "It's got mind control stuff, agent orange. Sheeple!" As a person of logic, laws and general conformity to sound advice, you judge that these loonies are risking their health and worse, they are endangering their vulnerable children.
But are people who reject an otherwise well-distributed vaccine doing something crazy? Maybe not as much as you might think. Suppose that everyone in the world has already had the vaccine, except you. Unless you're actively infected, then Nashococcal has been eliminated completely. So would you let a nurse stab you for nothing? Not unless she or he were particularly attractive and free for a drink later.
You and the people in your community are playing the Vaccination Game. Each person's outcome depends on their action and the aggregate of everyone else's actions. The cost of being vaccinated is fixed:
The cost of being vaccinated = 26 minutes of dizziness and a chance of swelling
The chance of a Nashococcal outbreak depends on the number of people without the vaccine, so the expected cost to you of not being vaccinated yourself is some function of the number of people who aren't vaccinated:
Cost of not being vaccinated = f(number of other people not vaccinated)
What does this function, f, look like? Well it's increasing with the number of other people not vaccinated. It's probably non-linear, so that the cost of being not vaccinated increases faster and faster as more people are not vaccinated. Big outbreaks happen when the population isn't sufficiently vaccinated.
So what will people do? John Nash Jr. tells us that rational agents will play his equilibrium. At a Nash equilibrium, you choose the best actions for yourself, assuming that no one else will help you and that everyone else will behave similarly. At a Nash equilibrium:
Cost of not being vaccinated against Nashococcal = Cost of being vaccinated against Nashococcal
If the two costs were different, then everyone would change their probability of taking the vaccine and it would not be a Nash equilibrium.1 The exact proportion of people who get vaccinated will depend. But the moral of the story is the crazy family who didn't vaccinate might be just as well off as the Spock family who did vaccinate.2
What are some factors that affect how many people get vaccinated? If the disease is highly deadly, then more people will vaccinate. But if the disease isn't so bad, then people won't vaccinate as much. If the side effects of the vaccine are small, then more people will vaccinate. But if the vaccine is almost as bad as the disease, then few people will vaccinate. (Real life example: the flu vaccines that I've had made me feel flu-like for half a day or so. The actually flu makes you feel flu-like for a week or so. By this reasoning, if you think you've got a smaller than 1 in 14ish chance of getting the flu, then you shouldn't get a flu vaccine. Most years I don't.)
In practice, people are not rational agents but they act based on their perceptions. So real life might not be like my toy model. There are also other factors. Some people cannot be vaccinated at all, like newborns. So it's a moral imperative that you vaccinate yourself to reduce the chance that the vulnerable will be harmed by your inaction. The social good is not necessarily maximized at the Nash equilibrium. That's probably why governments push people to get vaccinated: everyone will be better off if almost everyone gets vaccinated.
Notes:
1. Except in the two cases: First, no one takes the vaccine because it is always the worse option. (A bullet to the head often will eliminate any chance of future disease.) Second, the vaccine has no side effects and is always a better option. (I'm not sure if this is a real possibility or not; maybe it's something like taking vitamin C -- always a good idea.)
2. The idea of using game theory to model vaccination and epidemics is not new, see for example
Bauch, C. T., & Earn, D. J. D. (2004). Vaccination and the theory of games. Proceedings of the National Academy of Sciences of the United States of America, 101(36), 13391–13394.