Trillions are multiplying all the time, and you only need one to have an advantage over the immune system to relocate and spread in a population.
So every year the flu evolves to a new version because a beneficial mutation developed which couldn’t be combatted by the existing immune response or vaccines.
Not all viruses mutate quickly, some remain essentially unchanged for long periods of time. I’m not entirely sure what causes certain viruses to mutate faster than others, but one possibility is accuracy of the DNA/RNA replication enzymes. Some versions of DNA replication enzymes (called DNA polymerase) are more error prone than other versions of enzyme, and those that are more error prone are more likely to have mutations.
Also, how infectious the virus is will have a large effect on the rate of mutation as well, as a virus that is highly transmissible we infect more hosts and replicate more times than a virus with a low degree of transmission. More replication means more opportunities for mutations. Likely the rate of mutations in influenza is a function of both the rate of transmission and the copy error rate of DNA enzymes
Latest Answers