Vaccines are administered by a medical professional and contain dead or attenuated pathogens. They bypass the skin and are injected directly into the bloodstream.
The pathogens enter the body and are detected by the immune system. Phagocytic cells such as macrophages detect the pathogens and digest them in a process called phagocytosis.
When macrophages digest pathogens, they process the antigens and present them to b-cells which activate them against the pathogen.
These b-cells then divide into memory b-cells and plasma. The plasma cells produce thousands of virus-specific antibodies which attach to virus' antigens, disabling them.
If the body comes into contact with the specific pathogen in the future the memory b-cells will detect them and produce a strong immune response that the pathogen is quickly destroyed and the body is effectively immune to the virus.
This immunity isn't limited to the vaccinated individual. If a large percentage of the population are vaccinated then the un-vaccinated individuals in a population experience a level of artificial immunity as the virus is unable to effectively spread.