I;m just going to ramble a bit here. Apologies in advance if it doesn't make sense.
If you're asking "Why did Robin Williams kill himself?" you're asking the wrong question. For some of us who are depressed, the question is, "Why NOT kill myself?" When you're in emotional pain every single day and you don't see an end to it, suicide can seem like a way out. Not a good way out, but a way out nonetheless. The struggle then becomes to find a reason, every single day, to go on living. Any reason. And, for a lot of us, it's often other people. For me it's my son - when the demons start whispering in my ear about taking the easy way out, I fight them off by reminding myself about how much my son needs me and how devastated he'd be if I was gone. It's enough. It's always been enough. Fifteen years ago, during a particularly rough stretch, it was actually my cat who kept me going, because I had no idea what would happen to him if I was gone. Again, it was enough - I got through it and found better times.
The problem then becomes the fact that, being human and fallible, you will eventually fail the people who love you and who keep you going. You beat yourself up over it, you tell yourself how useless you are, and begin to think that maybe they would be better off without you. That's the trap. Those are the truly dark times. I don't know if that's the trap that Robin Williams fell into, but it wouldn't surprise me.
Finally, if there's one good thing that's come out of this, it's that we finally seem to be having a conversation about mental health in the United States. Here's hoping people keep paying attention long enough to do something about it.