I've thought about this for a long time, both in passing and in depth. I've read about those who take their own life, and I knew a few. I've even thought about it myself, to the point of having a detailed plan. which I shared with my therapist. (Supposedly, having a plan in place indicated how seriously your are considering the act.)
When I was a pastor, many people, on different occasions, asked why people took their own lives. First, I would tell them that it has absolutely nothing to do with demon possession. A mental illness is no more caused by demon possession than is lung cancer, heart attack, diabetes or any disease of any other organ. Let me tell you why that is the case and, if you are MI, let me set your mind at ease.
It's really no great mystery why people commit suicide, when looked at logically. Not considering extra measures being taken, when your heart fails, you die; when your kidneys fail, you die; when your liver fails, you die. All of these have one thing in common with the brain; they are all an organ. The one main difference is that, while most organs, like the ones listed, control our physical body only, the brain controls both physical and mental capabilities.
When the brain becomes damaged, often the person's understanding of their surroundings becomes altered. And many times, during this altered state, the mind causes the person affected to do things they wouldn't normally do. What we see as irrational behavior, they see as rational; it makes perfect sense to them. I feel it's important to remember that a mentally ill person is not a sane person who is simply acting ill; their reality is their mentally-ill self.
All organs have the capacity to destroy the host by no longer performing their normal function. The brain can also cease to work the way it should, by failing to function properly, either directly causing death, or failing to function properly, causing a disturbance in the persons mental capacity.
Suicide is seen as a great mystery because of the stigma. We really don't understand the brain, so we mystify it; suicide is mysterious, but it is not unexplainable.
(Note: My wife had a massive stroke recently, and the doctor said he might have to operate. And then he said if he had to do surgery,and remove the damaged area, he didn't know what he was doing, and would destroy good tissue at the same time ... it's even a mystery to the trained experts)