Breakthrough infection

There are diseases where there are vaccines. In most cases, people who are vaccinated will no longer get the disease. In some cases, people who have been vaccinated will still catch the disease they have been vaccinated against. This is known as breakthrough infection. In some cases, vaccines do not provide immunity against the pathogen. Breakthrough infections have been described for diseases such as mumps, varicella (chicken pox), and influenza. As the person has been vaccinated, the disease will look different, in most cases: Usually, the symptoms will be milder, and it may not last as long (compared to someone who has not been vaccinated, and who naturally contracted the disease).
There are different causes for breakthrough infections: The vaccine may not have been stored properly, or there may have been an error, when the person was vaccinated. Viruses change over time. The vaccine may have been developed for another version of the virus, and it may not be as effective against the current version. Also, antibodies may block the vaccine. 
For these reasons, vaccines are not 100% effective: The common flu vaccine is estimated to provide immunity to the flu in 58% of those vaccinated. The measles vaccine fails to provide immunity to 2% of children that receive the vaccine. However, if herd immunity exists, it typically prevents individuals who are ineffectively vaccinated from contracting the disease. Accordingly, herd immunity reduces the number of breakthrough infections in a population.
In April 2021, the CDC reported that in the United States there were 5,814 COVID-19 breakthrough infections, and 74 deaths, among the more than 75 million people fully vaccinated for the COVID-19 virus.
Causes.
Age.
As a person grows older, their immune system change. This process is called immunosenescence. They will produce fewer naive T cells, and naive B cells. There is a reduced number of lymphocytes (T and B cells). This means that in older people, there are fewer lymphocytes, and they are also fewer types of different lymphocytes that can respond to the pathogens in a vaccine. 
For this reason, many vaccines are less effective in adults over the age of 65. Despite this, the CDC recommend that people of this age group still get the flu vaccine: An influenza infection is particularly dangerous to them and the vaccine can provide at least some immunity to the influenza virus.
Antibody interference.
Infants have antibodies from their mother. This limits the efficacy of many vaccines. Maternal antibodies can bind to the proteins produced by the virus in the vaccine. Maternal antibodies can also neutralize the virus. The maternal antibodies help the immune system of the infant, which isn't very active yet: the infant produces fewer antibodies. This means that few memory B cells are produced. The level of memory B-cells is not adequate to ensure an infant's lifelong resistance to the pathogen.
In most infants, maternal antibodies disappear twelve to fifteen months after birth. Vaccines given to infants older than 12-15 months are not compromised by maternal antibody interference.
Lifespan of memory B cells.
When a person is vaccinated against a disease, the person's immune system is triggered and memory B cells store the specific antibody response. These cells remain in circulation, the pathogen infection is cleared. Cell division is not perfect, so the information about the response slowly disappears. Typically, the cells live for multiple decades. The lifespan and protection also depend on the type and dosage of the vaccine. 
The reason why some memory B cells live longer than others currently unknown. However, it has been proposed that the differences in memory B cell longevity are due to the speed at which a pathogen infects the body and the number and type of cells involved in the immune response to the pathogen in the vaccine.
Virus evolution.
When a person is vaccinated, their immune system develops antibodies that recognize specific segments of viruses or viral-induced proteins. Over time, however, viruses accumulate genetic mutations which changes the structure of viral proteins. If these mutations occur in sites that are recognized by antibodies, the mutations block antibody binding, which inhibits the immune response. This phenomenon is called antigenic drift. Breakthrough infections of Hepatitis B and mumps are partially attributed to antigenic drift.
Vaccine quality and administration.
Sometimes, the vaccine that is used has a poor quality. Examples may be vaccines stored at the wrong temperature, or vaccines used after the expiration date. Similarly, the correct vaccine dosage is essential. Vaccine dosage is dependent on factors including a patient's age and weight. Patients that receive a lower dose than recommended of a vaccine do not have an adequate immune response to the vaccine to ensure immunity.
In order for a vaccine to be effective, a person must respond to the pathogens in a vaccine through the adaptive branch of the immune system and that response must be stored in an individual's immunological memory. It is possible for an individual to neutralize and clear a pathogen through the humoral response without activating the adaptive immune response. Vaccines with weaker or fewer strains of a pathogen may primarily cause the humoral response: As a consequence, they fail to ensure future immunity.