When you have similar strains of a bacteria or virus, they can all cause the same immune reaction (which is how vaccines work) but tiny genetic variations in each strain can also drastically change how effective the reaction is against variant. Since bacteria/viruses reproduce very vast and the immune system is very good at its job, you essentially get an accelerated arms race that heavily favors the survival of the fittest. Even one part per million difference in probabilities is almost enough to guarantee the dominance of a single strain.