- Extreme mental illness and detachment from reality. A sane, well adjusted person doesn't commit mass murder unprompted.
- Infamy and remembrance. They usually feel their lives and existence are pointless and this will be the one way they were relevant to the world, even if it's for a horrible reason. Some seem like this is their biggest reason alone regardless of other factors.
- Desire to feel powerful and have others fear them. They want to have power over their victims.
- Anger, pain, jealousy, vengeance. They're often angry people usually internally grappling with some kind of pain or jealousy. The thought of other people being happy or having better lives than them enrages them and they want to deny others of the opportunities and happiness they feel wrongfully deprived of. Often they're incels and social outcasts, and resentful of it regardless of what they actually say about it. They want others to hurt and be angry and be deprived like they feel.
- Romanticism of the concept and other perpetrators. They hear of others doing it and find reasons to empathize with those people and their motives, often becoming obsessed with every detail of that person and the details of their actions, perceiving them sort of like a celebrity in their minds. Some even tailor their attacks, weapon and clothing choices, and specific dates to mirror others.
(Purely speculation. I don't claim to be an expert on them, or an armchair psychologist)