I think it depends on the person. They each have their own mindsets, though there are a few different types of suicidal mindset that include homicide, e.g. something along the lines of:
* The people fixated on family shame. They can’t stand the thought of their family story going a certain way (usually involving shameful stories about themselves, possibly including the impending suicide part), and they think of the idea of killing that family (often, the entire family) as a way to “avoid” that story, by ending that family, thus “ending” the story, and the main audience they’re attached to. Instead of, or in addition to, the “story” aspect, it may be their ego-identity.
* They may have an overwhelming desire to kill certain people for whatever reasons, but having done that, they then don’t want to live, to escape condemnation by themselves and/or by others.
* They may have an overwhelming desire to change some situation, but then (as above) that also leaves them suicidal.
* They want to kill themselves, but are thinking about the situation after that happens, and think it will be better if certain people are dead in that scenario.
* They want to kill themselves, but think, “well, if I’m going to die, there’s a list of other people I always wished were dead, so I may as well go for that, first”.
* They have been greatly suffering, and it seems to them like there’s a particular group or type of person who was responsible, whom they felt powerless toward or overpowered by, and have a bunch of rage towards, so they think to strike back, but then don’t want to get overpowered again (by the police & society), so they use their ability to kill not only to attack that group of people, but then to kill themselves rather than be overpowered again.