What's the science behind vaccines and how do they protect against diseases?

What’s the science behind vaccines and how do they protect against diseases?