Firstly, there are many tests and each one has its good and bad sides over another test. Some of the most basic tests are Tukey's, Bonferroni's and Scheffés, so we can compare and contrast these to understand what goes into choosing a test.
A useful explanation of choosing between tests (http://www.itl.nist.gov/div898/handbook/prc/section4/prc473.htm):
If all pairwise comparisons are of interest, Tukey has the edge. If
only a subset of pairwise comparisons are required, Bonferroni may
sometimes be better.
When the number of contrasts to be estimated is small, (about as
many as there are factors) Bonferroni is better than Scheffé.
Actually, unless the number of desired contrasts is at least twice
the number of factors, Scheffé will always show wider confidence
bands than Bonferroni.
Many computer packages include all three methods. So, study the
output and select the method with the smallest confidence band. edit: (This is listed in the source but is likely not a good idea).
No single method of multiple comparisons is uniformly best among all
Here is a simplified decision tree for choosing the correct test (http://www.statsdirect.com/help/content/analysis_of_variance/multiple_comparisons.htm):
- equal group sizes: Tukey
- unequal group sizes: Tukey-Kramer or Scheffé's
- planned: Bonferroni
- not planned: Scheffé's
In addition, you need to understand the difference between planned and unplanned comparisons. If you know every comparison that you want to compare then you can use a planned comparison test like Tukey and Bonferroni. If you think you may need to do some of the notorious data snooping then you can at least adjust for the unplanned comparisons with Scheffé's method.
In general, do not data snoop (unplanned comparisons) if possible. You need to understand what you are looking for (planned comparisons) and should consult with a professional statistician before deciding what test would be best. Also, an understanding of the data you are testing will allow you to do specific comparisons and thus allow you to use a specific test that gives you the most narrow confidence interval (detect differences) while being statistically correct.