Each state's law is different and it is vital that you are well-versed in the law, to begin with. In Texas, for example, you can use deadly force to stop the commission of a robbery, rape, and kidnapping (where the kidnapper is using a weapon). There is no requirement to retreat. As most of the other posters have written, each situation is unique and it's important that you have all the facts before acting. Calling 911 is the first step, if you have time. Being a good witness is also important. I know that I would not stand by and let someone be killed if I had a chance to intervene.
But think about this scenario: you are walking down a dark street and a woman comes running past you, screaming. She is being chased by a scruffy looking guy with a gun in his hand. Do you assume that he is trying to inflict deadly harm on her and shoot him? What if he's an undercover cop chasing a drug suspect?