How does one do PhD?
Simply put, the answer for most of your questions is: experience.
Advisors are usually people that are working on a specific field/domain for a while. They know the other people who work on this field as well (from conferences), and their work (from doing bibliographical reviews for each written paper).

In my experience, while it is indeed interesting to work on stuff that have a direct world application, that is not strictly necessary. Pure science is still science and you never know what people will be able to do with your research in the future.