How could you use a blood test to determine whether someone had been infected with a disease or had developed immunity through vaccination?
Immunity can be assessed by measuring antibody levels in the blood. If a person has been infected with a disease and mounted an immune response they will have antibodies in the blood. They will also have antibodies if they have been vaccinated. It can be impossible to differentiate infected cases from vaccinated cases. This can be important in animal biosecurity. Measurement of antibody levels doesn't enable differentiation between animals that have been exposed (and are therefore potential carriers of disease) from those that have been vaccinated.
Responses to vaccines vary from person to person. Some people will develop protective immunity while others will not. A good example is hepatitis B vaccination which is routine for health care workers in Australia. Some people fail to respond to vaccination. They can be identified by the low levels of antibodies in the blood.