Simply, suicide is so we won’t be a burden on the rest of the tribe. Here’s the theory:
Humans are altruistic; at least for our loved ones- family and friends- we will go to great lengths to support them, even to the extent of feeding, caring for and defending loved ones who are a net burden on the rest of their people. Why do we do this? Because human survival is group based: a band of hominids who were purely selfish individuals would not survive as well as a band that all stuck up for each other. In the long run, altruism pays (at least within limits). And that means we’ve been selected for altruism, to the extent that we’ll care for loved ones even if they will never be able to contribute to the group survival ever again. And we have very deep programming against “scuttling” people.
But at the same time, the truly useless ARE a burden, and they can hurt the groups’ chances of making it through rough times. So the optimum solution? Social creatures who are altruistic AND who will self-destruct if they feel that there is no point in their continued existence; sparing their loved ones both the burden of caring for them and the temptation to adopt “inhuman” tactics such as killing the useless.
What feelings lead people to commit suicide? Worthlessness, hopelessness, chronic pain or illness, depression (NOT mere sadness). All of which could be triggers for some sort of unconcious self-evaluation that triggers suicidal behavior if some “self-destruct score” exceeds a certain internal value.
So are people “supposed” to commit suicide? No; they’re supposed to help each other and that means eliminating the reasons WHY people might want to commit suicide: Friendlessness, social alienation, sickness, lack of worth.
I suppose a test of this hypothesis would be if any solitary, non-social creatures ever commit deliberate suicide.