Why does the HPV vaccine not work on already infected people?
This is an excellent question, and it is actually being studied -- but for a different reason than your question suggests. HPV is a bit unique because there is some data showing that infected individuals can become "reinfected" with the same virus type, causing reactivation of the dormant/latent virus that they are already infected with. So the question in this case is whether administering an HPV vaccine to an already infected individual can help prevent (or minimize) reactivation of the latent virus. 

Here's a journal article explaining some of this research. Please note that it is not standard medical practice to give HPV vaccine to already infected individuals. This work is still in the research phase, and is aimed at minimizing viral reinfection and reactivation:
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5006803/

Simply put, a vaccine only works to prevent infection with a specific virus. It is rarely effective in treating a virus once a person has become infected. The reason for this has to do with how the immune system responds to its first encounter and subsequent encounters with a particular virus:

When the body encounters a specific virus for the first time, the immune system mounts a "primary" immune response specific to that virus. A primary immune response triggers the body to produce virus-specific immune cells that can generate antibodies against that virus. The body continues to make these immune cells in small quantities even after the virus is eliminated. 

If the same virus is encountered again later, these cells will proliferate and immediately start producing antibodies against the virus. Thus, the body can mount a much faster and stronger "secondary" immune response. This prevents the viral load from reaching levels that produce physical symptoms, so the person does not become sick (or at most they may have milder symptoms), and the immune system is to able eliminate the virus more quickly. 

The purpose of a vaccine is to trigger a primary immune response. With a vaccine, the body is exposed to a weakened form of the virus, and a primary immune response is triggered without the individual becoming sick. When the individual encounters the real virus, the body immediately mounts a secondary immune response, which fights off the virus much more efficiently and quickly, and the person typically has no physical symptoms.

Here's a more in-depth explanation on the difference between a "primary" and "secondary" immune response. Most cell biology textbooks (and all immunology textbooks) will have an explanation of this as well. This is an important concept in understanding how vaccines work:
http://www.microbiologynotes.com/differences-between-primary-and-secondary-immune-response/

If a non-vaccinated person is infected with a virus, administering a vaccine generally has no effect. At that point the body is already mounting a primary immune response, so a vaccine would serve no purpose. Because a primary immune response is slower than a secondary response, when a non-vaccinated person gets infected the viral load is able to increase more rapidly than it would in a vaccinated individual, resulting in the physical symptoms typical for that particular virus.

What makes "chronic" viruses such as HPV and Herpes virus (including chicken pox) harder to eliminate completely is that these viruses enter a dormant/latent (lysogenic) phase. At that point they become "invisible" to the immune system. Even if the person is not visibly sick, they are still infected with the virus. If/when the active (lytic) phase is triggered, the viral load increases rapidly -- more rapidly than if it were a new viral infection. The body still mounts a secondary immune response, but typically this will not completely eradicate the virus. As long as any amount of the virus is in the lysogenic phase, it remains "invisible" to the immune system. 

With some viruses (e.g., chicken pox virus, which causes shingles) if a vaccine is administered during the latent phase, this can help somewhat with making symptoms milder if/when the lytic stage is ever triggered. But this doesn't work for all viruses. 

If a targeted antiviral medication is available (e.g., Tamiflu for influenza; Harvoni for Hepatitis C) this can slow down the proliferation of the virus, allowing the immune system to "catch up" and eliminate the virus. Antiviral medications aren't vaccines. They are designed to directly target the virus and interfere with a biochemical activity that the virus needs in order to proliferate. 

Currently there is no antiviral medication available for HPV, although a few drugs are being researched. One drug in particular (ranpirnase) looks promising, but it is still in early clinical trials.