Your odds of being shot in one of these incidents is negligible. You can reduce the chance to about zero by staying home, but that won't grant you immortality. It won't even extend you life expectancy.
Barricade yourself in a bullet-poof house. That is the only way. Every single time you leave your house there is a chance you will die. It's always been like that. You just have to trust the society around you to not kill you, which I suppose is getting harder to do these days, but that's a gamble we take every day.
No place to run and hide. No use living in a bunker. Try to live a normal life, talk to someone about your feelings on this topic. Getting a gun is not going to fix the issue. There is no place people haven't been shot if you can get shot in school, church, or the local movie you can get shot anywhere. Just enjoy your days, one at a time!
Very few people have been shot in terms of the number of people in the US. If you're worried, skip big parties that could have criminal copycat fanatics and avoid college campuses, but seriously, you don't need to worry. Be there for the people who need you.
The main defenses against incidents like this are situational awareness, an escape plan, and adequate preparation, to include either self-defense or similar personal protective strategies. For some, concealed carry and protection using ballistic armor are possibilities; for the average person, this is impractical.