Suicide is a very complicated phenomenon, as you know. In any given case, there is a particular pattern of things that play together.
The things that are of the essence are stressful life events. Usually there is one or more stressful life event. Usually at some point there is an acute stressor that contributes as a trigger. That often intersects with mental disorders, notably depression and other related disorders. That then combines to form suicidal thoughts in people. Many people have suicidal thoughts, but then certain things that occur later on down the line actually condition to whether those suicidal thoughts turn into suicidal acts.
Those things that tend to tip someone one way or another include impulsivity. People who tend to be impulsive and have a suicidal thought may commit suicide, whereas other people who are just by nature not impulsive don't. Hopelessness, pessimism—all these psychological factors play roles.
The other factor that is underappreciated is the role that access to lethal means plays in suicide. There is abundant evidence that availability of handguns in particular is a strong risk factor for suicide.
There have been studies that have looked at the composition of household cooking gas. You hear the stories from the past of people sticking their heads in the oven and committing suicide. It doesn't work anymore because cooking gas no longer contains carbon monoxide. In the United Kingdom and elsewhere, where they've decreased the amount of carbon monoxide in cooking gas, they've seen significant decreases in the overall suicide rate.
Imitation of suicide events also plays a role. When people hear about suicide in the media, there is some evidence that it can trigger susceptible people to commit suicide.
Those are some of the factors that come into play.