Statistical physics of vaccination