Most people have some point in their lives where depression or other things make the pain of dying seem more acceptable than the pain of living. Some deal with it and some do not, plain & simple. If you know someone in a situation all you can do is let someone else know (and that is terribly important). It shows that you care more about that person. Never take a comment like that lightly. Some people even offer to go along to counseling with the person who is suffering and sometimes that helps, too.
One thing that can be hard to deal with is when someone who is suicidal becomes very relaxed and happy about life. Sometimes, especially when that change is sudden, it means that they have made a decision. Sometimes that decision is to die. It makes the shock even worse, but it happens often.
Sometimes there simply is nothing that could have been done and it takes time to realize that and to accept it.
I won't go into whether or not it is ever right for someone to kill themselves. To me that argument is pointless because the person who is suicidal is the one who will make the decision regardless of what I think.
Better to always try to be as good a person as you can be to everyone and to be as good a friend as you can to those who are your friends. Anyone who spends their time being a jerk is wasting the time that they have on this planet.
Always better to remember good things about someone no matter how they died. It makes their life more worthwhile and eases your pain, too. It's one of the reasons why I often propose a toast when I'm out with people -- the one I say is, "To absent friends."
Sorry for your loss.