Any genes that encode suicide would be selected against so quickly they would not make a dent in evolutionary history.
There are selective pressures on societies, but they are utterly and completely dwarfed by the individual selective pressures. Whenever there is any sort of conflict between societal selection and individual selection, evolution will not give the former any say.
The reason is that it takes many many generations for any genetic makeup to actually destroy societies as a whole, and it is an extremely rare event. Genetic selection based on individual success happens all the time.
Suicidal genes wouldn't be selected against if they conferred some greater advantage. See the sickle cell anemia gene for an example of something that's tremendously deadly yet evolutionarily favored in some circumstances.
That would do it too. It seems unlikely that this would be the case in humans, since suicide affects so many young people, but it's at least theoretically possible.
I suspect that the genetic components of suicide are side effects from the various genes that help make us smart.
The benefit doesn't have to be to the suicidal individual, though.
One copy of the sickle cell gene confers a tremendous advantage: great resistance to malaria. Two copies of the gene kills the unfortunate person fairly quickly in the absence of modern medicine. There's no advantage to suffering from sickle cell disease, but there's enough of an advantage to other people that the gene persisted and even flourished in some populations.
Suicide could be similar. There are probably a bunch of genes which coordinate to work on our brains, and are generally advantageous. I speculate that in certain combinations, these genes contribute mental illnesses, including depression and tendency toward suicide. This doesn't get selected out, because those genes in other combinations are still highly advantageous.
Yes, indeed, the gene may be detrimental under certain conditions to the individual (e.g: two copies of same gene), if it helps the individual in the average case.
There are many nuances that my statements in previous comments gloss over and which make them incorrect.
My point is that "societal selection" of genes is rare and virtually completely insignificant.
There are selective pressures on societies, but they are utterly and completely dwarfed by the individual selective pressures. Whenever there is any sort of conflict between societal selection and individual selection, evolution will not give the former any say.
The reason is that it takes many many generations for any genetic makeup to actually destroy societies as a whole, and it is an extremely rare event. Genetic selection based on individual success happens all the time.