As a manager, even if you see The Signs, you rarely have 100% confidence: it's hard to tell if they're taking days off because they're interviewing or because their toddler is sick again. And if you take a punt and ask if they're going to leave, that's not going to go well: even if they are, they're going to deny it until the offer is signed, and it's going to come off as adversarial.
IMHO, once the switch of "I can't take this anymore and I want to leave" has been flipped, it's very difficult to flip that back. So your job as a manager is to do regular check-ins at sufficient frequency to identify and correct any issues before they get to this stage -- although as you say in your last paragraph, often these are outside your control. Which is why I've had X people leave my team in the past year, and am currently interviewing myself.
IMHO, once the switch of "I can't take this anymore and I want to leave" has been flipped, it's very difficult to flip that back. So your job as a manager is to do regular check-ins at sufficient frequency to identify and correct any issues before they get to this stage -- although as you say in your last paragraph, often these are outside your control. Which is why I've had X people leave my team in the past year, and am currently interviewing myself.