Injecting a person with a killed-bacteria vaccine can protect that individual from disease because the proteins of the bacteria:
Remain in the body and live bacteria later prey on them instead of live tissue.
Bind with receptors in the body, so that live bacteria cannot bind with them later.
Stimulate the production of antibodies which can be manufactured later response to infection.,