...I know for a fact that NYPD police officers receive hundreds of hours of training and range time in learning how to accurately shoot firearms. Every officer on the force is capable of hitting a fist-sized target from a distance of eight feet. Officers must routinely re-qualify on their pistol skills to remain on the force.
True enough, but handgun exams are generally done in controlled situations where you're standing in a shooting range aiming at a target that isn't moving with no distractions. You might score perfectly, and then on the street with people running and yelling and your target trying to evade you, rush you, throw things at you or shoot back it's entirely possibly you might not be able to hit anything with your sidearm reliably, even at 8 or 10 feet.
I'm accurate with a handgun in controlled situations without distractions out to maybe 30 yards, beyond that I can't reliably hit a paper target (without a laser sight). Add people moving around behind me, someone yelling or a group of people conversing, someone talking to me or trying to get my attention, and suddenly I can't reliably hit the paper beyond 10 yards. Add people moving around behind my target, people moving suddenly or erratically, yelling, pushing each other (or me) and it's easy for me to see how the NYPD incident happened without any ill intent on the part of the responding officers (or the mayor, LOL).
If police officers 'lose it' amidst threatening situations surely the same would happen to anyone, including a teacher or a bystander who happened to be carrying a handgun and decided to play Hero. The difference is that the teacher or the random bystander who decided to shoot the 'bad guy' would be sued or jailed if they accidentally hit an innocent person, or even if they damaged property. Sometimes what looks like a gun from a distance isn't, or turns out to be a fake. In those situations, a vigilante who shoots to kill has just committed murder, and will be (and should be) treated appropriately by the criminal justice system.
As I said before, if we armed teachers or principles and expected them to use their firearms in cases of school shootings, even if we forced them to endure training at the level of police officers, in the heat of emergencies they'd often enough make poor decisions and the end result would be more bullets ricocheting through school hallways and most likely more injured people (including children), even if the shooters were killed by a teacher's lucky shot rather than by their own suicide shot. The best way to deal with the problem of school shooting is to intervene in the would-be shooters life well before they start planning their massacre. If we fail at that, the best we can do is prey and clean up the mess as best we can.
I used to work occasionally in the personal protection sector, and the discussion of whether to carry a firearm or not came up a lot at training seminars I attended. The liabilities involved in using or even just drawing a firearm during a conflict can be huge, and I never once carried when protecting someone in a professional capacity. It never seemed worth it, and neither I nor my clients ever regretted my decisions on that front.
...the element of surprise goes after the first shot. After that, a mass shooting spree is unlikely with teachers all over armed to the teeth.
Even though guns are loud, there are a lot of things that can make similar sounds in buildings, and the gunshot sounds can be muffled or distorted so that those far away can't recognize them for what they are. Even if one does recognize a gunshot (or series of them) for what they are, no one in their right mind would storm the room where the shooting is happening. Those sorts of entrances only work in the movies. In the real world they result in the defender getting shot and perhaps killed outright, giving the shooter access to their gun and ammunition despite their best intentions otherwise.