There is no one reason, but with Donald Trump as President and Right Wing Republicans in Congress, and continuing loosening of gun laws by states, these shootings are mostly in Right Wing Conservative districts. Easy access to guns by teenagers, parents giving that access and even encouraging use of guns, divisions among people by an oppressive government pressing for conflicts, lack of government leadership, low education standards all contribute to it. The shooters tend not to expect to actually live through it, or don't care. We have lost empathy in society.
Current teenagers are under a much higher stress level than in earlier generations. There are far more inputs coming at them and no outlets to reduce the stress. School funding for extracuricular activities very well could be a contributing factor. School funding for guidance counselors, or low pay scales of that field as well, where teens have no one to turn to and nothing constructive to do with time.
Broken homes, as the traditional family of married mother and father and their biological children is a shrinking situation.
Little parental guidance, with both parents either too busy or totally unskilled to raise children.
I won't state these are the only reasons, but as a whole there are disturbing statistics.
Death by firearms increase with loosening gun laws and easier ownership standards. This includes suicide plus accidents plus homicides. Meanwhile, homicides reduce by improved economy and jobs, camera surveillance, medical access and techniques to change gunshot wounds to survive instead of die, number of police, and policing methods. These shootings are part suicide as the shooters just about always die or get put away for life if not killed.
People with ready access to guns are more likely to be killed by guns then those who are unarmed or don't have them in homes. This is considering all reasons behind it and is just a total measure.
Should a school be like a prison? Is that the only answer? Do we want more guns in schools by teachers and security officers, and what of their mistakes? Each mistake will cost millions in legal settlements.
I think society in the USA has very many issues that are made worse by government and parents and gun laws and school funding and a growth in divisiveness (divisions) of people who have more of an attitude to fight than work together. The Centrists, who are the historical glue of society, have been shrinking and weakening in favor of the radicals at both ends.
Too much answer? Well, complex issues have complex answers and explanations. Anything simple is easily resolved, and too many people are looking for simple answers that don't exist, are wrong, or plain fail.