Update: This post is not meant to advocate suicide. It only speaks to evoluationary motives.
Suicide is often a natural behavior. This is because it may help to pass genes.
This seeming paradox is resolved when you consider the implications of inclusive fitness, or more specifically with regard to kinship selection. This refers to the fact that close relatives have a high number of genes in common, the hence the passing on of shared genes sometimes benefits from sacrifices at the expense of one or more relatives, even leading to death. Particularly, individuals with low access to resources needed to pass genes directly, relative to family members, become a drag on the resources of others in the family.
This idea was perhaps first put forth by Denys deCatanzaro, but the logic first appealed to me years before I found this paper and related research.
This is not to say that all cases of suicide are related to kinship selection, but does suggest the existence of a sort of "mental program" that is activated by low moods, relative to family members. Other causes for suicide include the metacognitive avoidance of psychical and or physical pain, the influence of psychoactive drugs, and more purely neurological causes.
Quantitative Psychological Theory and Musings