Ultimately, I think that nearly all of these incidents are some variety of suicides. Trying to prevent these by looking at them as homicides is futile. Effectively treat the school-age suicide problem and I suspect we'd mostly prevent future school shootings.
That or a variation thereof. I'm not an expert, but if heard often that teen suicide attempts, especially for females can be a "cry for help". That's explains why pills might be chosen over bullets for example.
If someone just wanted to not live, they could walk off a cliff, jump in a lake holding an anvil, etc.
But these are public performances. They want their pain/anger witnessed and presumably understood by an audience.