It is not easy.
This is one of the hardest things a doctor has to do.
There is no simple way to handle this, just learn by experience. Often the patient is not prepared, and does not want to think about this possibility. Sometimes they already suspect that this is the case. Whichever it is, noone knows how it feels until they do it themselves.