How to decide which university to study for PhD I have seen many different research students that want to apply for a PhD or MSc program but they are so nervous about their choice. Sometimes they pay most of heir time, reviewing the websites of the universities, profiles of the professors and do their best to gather information and choose the best PhD program or university to apply for PhD but they are still nervous about their choice.
Some students only think that the universities with higher rankings are best to apply for and they miss some middle-ranked universities which are so good at their majors. This way, their chance to apply for those high-ranked universities is so low and they may lose two or three years preparing and applying for those university. While in the same period of time, if they had applied for that middle-ranked universities, they had higher chance of applying and in this period of three years, they would have finished most parts of their PhD program.
My question here is about these things:


To what extent a person should be realistic in choosing a university for his PhD program. A normal student may be more successful in a middle-ranked university than a higher-ranked university.
I think that sometimes, normal students lose their confidence when they study at high level universities, while; if they study in good middle-ranked universities, their academic output may be much higher and they will be a more successful person.
Does it worth that a person that has high chance to be accepted in a good second ranked university, wait for two or three years to modify his curriculum vitae and apply for a first level university?
Which one is more acceptable and appreciated? A top student at a second ranked university or a poor and not so much successful student in a very good ranked well-known university?  


I can not decide in this period of each persons' life, how he should make decisions. This also applies to other circumstances. For instance, working in good company with lower income or working in a not big company with higher level of income. Making clear how a person should make decisions like this may be so much helpful to me.
Choosing a place to do a PhD is a hard task, but one that needs to be completed before you start. I would call your attention to three main points that you need to consider to choose well.

First point is alignment of research interests, methods, and schools of thought. Different research groups have distinct ways of thinking even when looking at the same research topics, therefore, it is important to carefully look whether you fit or not with the research they do, and how they position themselves towards that research. This you can see in the research papers that are published (or not) by them.

Second point is the personality and ways of working of the professors and colleagues. The time you spend in a research group will shape the way you think about and approach research. In some way, you will level your conduct through the examples of the ones around you. For this reason, I would advise you to look for a group that works in an professional, collaborative, open, and ethically sound way (in your opinion). This you can discover by talking with other PhD students and with people that used to be in that institution.

Third point is what you want to do next. If staying in academia is important for you, it would be important that the group publishes in top venues in the area. If going to industry is a path you would prefer, maybe you should look for a place that already has many connections with companies, or that enables you to do some part of your studies while working in a company.

These points are the most important for me.

I do not think that you have to be in a top-5 university to be successful during or after your phd. In the end, it is all up to you. Of course the environment helps, but you will be the one driving your papers and manuscript, so it is up to you. 

Top students will be top everywhere, but it is important that they have people around them that can recognize and foster their talent. Look for someone that understands what you want to do and that trusts you from the beginning to take it to another level.

good luck!