a student of mine recently expressed a significant concern regarding surprise attacks. he could not be certain that he would be ready for an unexpected attack. he imagined being consumed by fear, or not responding appropriately because he was thrown off. here are the thoughts that he provoked.
unexpected attacks are just that: unexpected. normal citizens cannot be expected to have their guard up all the time. even law enforcement officers and security contractors can be caught off guard. what happens in this world are not within our control, and that is something everyone has to come to terms with. martial arts training is not some form of magic that will provide an invisible protective shield around you at all times.
as a person concerned about your personal safety, you have to be satisfied with the level of awareness, of your environment and the people around you, that you maintain at most times. you can't be so wound up that you attack anyone that comes near you, but you can't be so relaxed or distracted that you don't know you're being marked and mugged until you're surrounded by three attackers. you have to do the best you can.
in the same way, you can train responses to types of situations. and you need to be confident and satisfied that the training you are doing is the kind you can count on to keep you defended and safe. on top of that, you have to believe you are training hard enough and realistically enough that you can defend and save yourself in bad situations.
if people attack with fists, know empty-hand tactics. if people attack with weapons, know weapons tactics. if people attack aggressively, know how to handle aggressive energy. just like boxers train for fights by sparring in rings, and brazilian jiujitsu practitioners train for competition by rolling on mats, you can train for the street by doing multiple attacker drills on concrete.
you can also train by running. running is an option! getting away from the attack is the safest thing you can do. but in the case that you are required to strike back, you will be glad you have done some sort of combat training.
you might not know when you'll get attacked unexpectedly, but you have the ability to know that you have done all you can to prepare for those times. train well.