What are the most important factors influencing a person’s gut microbes?
Our Unique Microbial Identity (Gilbert 2015) suggests that the gut microbiome is shaped and stablized during infancy and tends to restore equilibrium if it is disturbed later in life. Antibiotics temporarily change the composition of the gut microbiome (by suppressing the growth of certain groups of bacteria more than others), but it tends to drift back to resemble its original (stable) community after treatment is stopped, likely due to the interdependency of individual strains as producers/consumers of particular compounds (i.e., some bacteria will eventually arrive to serve a particular role in the microbial community). A recent study in antibiotic treatment provides some empirical evidence of the long term effects of antibiotic treatment on the human gut microbiome.

The American Gut Project is currently open to the public for participation, and it has the goal of identifying exactly the factors you describe. They are accepting samples from individuals across the country, along with lifestyle information, including dietary habits. A related publication by the group provides a summary of the common gut bacteria implicated in a variety of diseases.

H. pylori infections are a common gut microbiome health issue. This bacteria is present in about half of gut microbiomes and are not generally harmful unless the stomach lining is already compromised (e.g., due to medication or diet). In those cases, they can become opportunistic pathogens that can persist for decades and cause peptic ulcers which can lead to a variety of difficult to diagnose ailments such as arthritis.