It's likely a combination of factors including mental illness, availability of firearms, social media, feelings of persecution or wanting to belong, revenge, no perception of the consequences, lack of respect for the sanctity of human life, politicization, etc. No easy solution.