You can divide the causes into two categories- what motivates the inadequate to commit the crime and what factors enable him to actually do it.
The availability of guns does provide a partial answer to the second part of the question. The day before the killings in Connecticut a Chinese primary school had been attacked in a similar way but in this case the weapon was a knife rather than a gun. A lot of children were injured, some severely, but no one was killed.
That said the more important aspect is surely what makes someone want to commit a massacre- it isn't simply the case that someone out there will always want to do something like this. After all gun ownership has been widespread for generations in the USA and some other countries yet these kind of spectacular rampages are a relatively recent phenomenon. There seems to be a desire for notoriety and a perverse kind of fame as well as a kind of narcissism in which only their anger and hurt feelings matter.
Update: Just realised that I wrote a similar but better written post a couple of years ago.
This week’s PB/Polling Matters podcast
3 hours ago