The recent case of Aaron Swartz brought a topic up into public discussion, which I have read and thought about quite a bit since my university times. It's an unfortunate property of public discussions on such topics that they become very emotional and come to quick conclusions. There are those who say: "what a cruel society which pressures bright young people like him into such terrible situations" while others say: "what a stupid guy who plays with fire, but is not willing to take the consequence of his actions". Some blame it on the circumstances, some blame it on the person. But I think that suicide is just a quirk of nature. Some psychological defenses that misfunction. And I think, we can easily prevent suicide by tricking around those defenses. Ready to hear the full story?
As far as I learned from Wikipedia, Aaron had an offer to go to jail for six months in order to avoid a trial for his alleged crime. (And, no matter what you or I think about whether information piracy should be a punishable crime and if yes how hard, this proposed sentence is comparable with previous cases which Aaron or at least his friends probably knew about...) My first thought was that six months of prison doesn't seem like such a bad deal. Many famous (and innocent) people have been in prison (I think especially of Nelson Mandela and Deng Xiaoping) and used the time well for reading and writing and strengthening their personality. But this was probably not the way, Aaron saw it.
So what was going on in the mind of Aaron Swartz? Since I don't know him, other than being a big fan of his study on Wikipedia editors, I will answer a more general question: what goes on in the mind of a person who decides to end their life? Here's the first misfunction of human brains: they don't take things at face value, but often add a ton of symbolic value and interpretation. For example, someone who's bound to go to jail might think about all kinds of awful things that happen in jail which can trigger a hugely exaggerated emotional reaction in that person. But what's worse, if you think you have to go to jail although you're innocent, you might lose faith in the entire system of justice and therefore (since the emotional part of the brain likes to exaggerate and generalize) the entire country and/or society. Following that logic, you might not see any reason to stay living in this country or this world. Trained minds can diffuse such logic by taking an outside view of the situation. To an outside observer, one case of unjust detention wouldn't seem to be a surprising (albeit still regrettable) event given a small percentage of every prison contains people who haven't deserved their sentence. (Just as there are a lot of uncaught criminals, too.) We already know that justice is imperfect. (And looking at cases like Guantanamo, we also know that US "justice" is sometimes genuinely evil.) I believe that a trained mind can notice when its emotions are overboiling and it can give itself a rest to try and take on a different viewpoint.
If it is so easy to work around this particular bug of the human brain, you might wonder why none of Aaron's friends and close ones noticed his precarious state and intervened to bring him back to the bright side? Now comes human brain bug number two: emotional arousal and the feeling to be betrayed makes people distrusting, which sometimes can even affect friends and close ones. How many times have you seen someone giving well-meant advice only to get this exact reply: "You don't understand!". Unfortunately, even the most well-meaning friends often give advice without listening enough and asking the right questions which will permit the affected person to speak their unspeakable fears. And also unfortunately, an affected state of mind will assume that "if you don't ask, you don't want to hear" and maybe even think "if you would hear, you wouldn't believe". It takes a little bit of psychological manipulation to make such an affected person feel at ease and be able to open up. And what's worse, someone trying to help must overcome their natural tendency to be offended by a harsh rebuke of "you don't understand" and instead recognize it as a signal, that something important is going on. I think that most people could -- by practicing meditation, empathy, and compassion -- at least recognize that something is wrong with someone and ask a mentally better trained friend for help. The thing we have to learn and accept is that our natural instincts and reactions sometimes make things worse and everybody who's interested in their own mental well-being (as well as that of their friends and family) should look into practicing self-awareness to better recognize their own mental state. We all have defective brainware -- and we all have the capacity to overcome our deficiencies and strive to become part of Humanity 2.0 where all people are well-intentioned and make the best out of their strengths and weaknesses...
PS: My condolences to all those who knew Aaron. With my post I certainly don't want to judge him or his close ones. All I am trying to achieve is to raise awareness that we might all fall victim to our brain bugs (although for most the results are not as severe) and that we should train and prepare ourselves to survive this life better. And I am sorry for not being able to give more precise advice. I am not an expert at all. Just a bystander who recognizes a certain pattern and tries to offer a more constructive point of view.