Vaccines are not dead versions of a disease causing organisms. When you become infected the organism has something in it called antigens, these antigens trigger your body to produce white blood cells to attack and destroy the invading organism. These antigens are not the only thing the organism contains, the rest of the organism is causing your symptoms, as well as reproducing itself as much as possible; it's just trying to survive like anyone else
When you get a vaccine you are getting the antigens without the symptom causing parts of the organism. Your body detects and builds its white blood cell army with little risk to the host (you). Once your body has successfully fought off an invader (vaccine or not) it remembers the fight and stays prepared, or better prepared I would say. Some virus's mutate making it difficult for your body to remember, but many do not. Of these we create vaccines to prevent people from experiencing any symptoms, especially the symptom of death.