Vaccines work by exposing the patient's immune system to potentially dangerous pathogens, which can be weakened or dead, and stimulating an immune response that confers protection when the patient encounters the virus in the wild. According to the New York State Department of Health, vaccines "train" the patient's body to produce antibodies specific to the strain of pathogen in the vaccine.
According to the National Institute of Allergy and Infectious Diseases, vaccines mimic the chemical signature of wild diseases that pose a threat to human health. For example, the vaccine for yellow fever contains a form of the virus that is biochemically indistinguishable from the wild strain, but has been weakened to inhibit its virulence in humans.
The human immune system is not able to tell the difference between the weakened form of the virus and the naturally occurring strains, so it responds to the largely ineffective virus in the inoculation by producing pathogen-specific T-cells that secrete antibodies to act against both strains. Since the live culture in the vaccine is ineffective at reproducing itself in the human body, the risk of developing yellow fever from the culture is low or nonexistent, says the Institute, and the body has the necessary time to develop a successful response.