How exactly to do that is the tricky part, though (and not just tricky for individuals, but the subject of much debate in psychiatry). Possibilities include pharmacological intervention, therapy, or some sort of change in circumstances. The latter is a really large set of options, but also poorly understood: there are semi-regular reports of people completely changing outlook after significant changes in circumstances (e.g. changing careers), but it's very hard to come up with rigorous evaluation of the success of that "treatment option", because it's not very easy to run a controlled study, and not always an available option.
A good start might be with the book "Learned Optimism" from Martin Seligman — http://www.amazon.com/Learned-Optimism-Change-Your-Mind/dp/0....
He argues that most depression is just severe learned helplessness caused by your own pessimistic inner explanations of why events happened. He makes a good case for it & suggests techniques to build better explanatory habits. I haven't finished the book yet but so far it's quite compelling.
https://github.com/raganwald/homoiconic/blob/master/2009-05-...
My won feelings about helplessness learning to play Go parallel feelings if helplessness in my life trying other things where it felt like I had no idea what I was doing and no control over the outcome:
https://github.com/raganwald/homoiconic/blob/master/2009-10-...
Again, I don’t know if any of this is helpful when someone is at the point of contemplating ending their own life.
Suicidal ideation is a process starting with falling short of expectations then blaming yourself for the shortfall. You start incorrectly rationalizing reasons why everything is your fault and how nothing can get better. Negativity permeates every thought. Your world breaks down into tiny logical blocks and you rationalize why everything is hopeless.
The only way out is to break the chain of elevating mental isolation and negativity. It's easier to stop it in the nascent stages. Try not to blame yourself. The world is a big place and we have so much to do.