small amount of dead or inactive pathogen are put into your body, often by injection.
the antigens in the vaccine stimulates your white blood cells into making antibodies destroy the antigens without any risk of you getting the disease.
you are immune to future infections by the pathogen that's because your body can respond rapidly and make the correct antibody as if you had already has the disease.