A former Admission committee chair once gave me this advice. Split your application into 3 tiers, and apply a couple schools in each tier. For example, 5 in Top 15, 5 in 15 - 30, and 2 in 30 - 50. The last group will be your safety school. It might be a good idea to choose the lower ranked schools to apply to in part based on what different programs are good at. In general, if you can get into the top 20 programs, you should go for the highest ranked one because those programs are generally very good in all major fields, but as you go down the rankings, the fields become more important.