I've been thinking about this subject a lot lately after taking care of my mother in her final months. I don't want to linger, deteriorate, and be a burden, although that seems to be the case most of the time as people live longer and longer.
I read an article about suffering AIDS patients in the early days of the epidemic who knew they were going to die and kept a "suicide" drug potion beside their beds. But by the time they had deteriorated to the point of taking the drugs, they no longer had the mental clarity to follow through. Deciding "when" would be the challenge, since we don't want to go while we're still healthy, but there comes a point during the decline when there is no longer the capability of making that decision.