People always make the assumption suicide is a choice. In the sense that you reach the decision to do it, yes, it's technically a choice. But if you look at the root of suicide, depression, it becomes less a choice and more a byproduct of circumstance.
It's important to note the ties between depression and suicide. The vast majority of suicides are performed by depressed people, specifically shortly after the worst of a depression episode. During the depths of depression, suicide is rare because the energy necessary to perform suicide is not there. It's when the person starts to get better when most suicides occur, as the thoughts are still there, but the energy is now present as well.
Depression itself is a product of both the environment and genetics. A person prone to depression who can avoid all environmental triggers will not suffer from depression. A person who is resistant to depression and is put through a terrible environment stands a good chance at not being depressed from it. But when you get a bad set of genes and get placed in a bad environment, depression hits hard. Depression is not just extreme sadness, but is the result of abnormal production of neurotransmitters in the brain, specifically an underproduction of serotonin. Serotonin is responsible for creating feelings of happiness, among other things.
Long story short, most people who attempt suicide don't do so out of spite or anger, or even regular sadness. Depression feels like everything in life is hopeless, nothing will bring you happiness, and the despair of it all is overwhelming. Personally, I become catatonic to avoid dealing with the crushing feeling that comes with it, time becomes impossible to tell because every moment is an eternity. When you have to deal with it for days, weeks, and eventually months without an end in sight, death becomes preferable to the agony of life.