Pretty much what others said here, but to briefly summarize all the points, basically 3 things:
1) A secluded place where intervention is least possible (including making it hard to be saved, putting obstacles in the way to make it less likely.)
2) A sturdy enough structure (beam, branch, frame, object) to support your weight.
3) Proper technique and strong enough rope to hold your weight (similar to #2).