I've had this happen many times but never when a human life was at stake. I've had countless duds over the years and several shotgun rounds where the primer went off, but not the powder.
Two memorable occasions:
One was while deer hunting. I had decided to take a small 4-point as a cull buck on some private land. I squeezed the trigger and... click. He looked right at me. I realized that I hadn't chambered a round after climbing into my stand. I was able to reach up and bolt the gun before he figured out what I was. He was acting really nervous and ready to run but I was able to make it happen.
Another time I was turkey hunting and had chambered a round, but the bolt wasn't all the way forward. The turkey jumped at the sound of the click but I was able to chamber a round before he spooked. When he stepped out from behind a tree, I nailed him.
When it really matters, I double and triple-check everything.
To a much greater extent than most mechanical devices, firearms are terribly unforgiving of any overconfidence, complacency or negligence.