How should someone choose a PhD topic so that she doesn't fail?
Make sure your advisor has a good track record of graduating students in time.
Anyone just entering or outside the field won't be able to assess PhD topics with good judgement, so it's unfair when advisors fail their students by giving them bad projects. Your best bet at avoiding this is finding an advisor who is unlikely to fail students in this way.
If you find yourself in this position, a good bet is to reach out to other professors and tell them what's going on. It can feel shameful, but I've seen many success stories of people getting a new project and spinning it into enough for a PhD when things aren't working out with their initial advisor.