First, realize that nobody just wants to fight you. If someone presents as wanting to fight you, it means they have a problem, and the best (or only) solution they see is to fight you. Which may or may not solve their problem. (Of course, if you owe the mob and your attackers were specifically sent to specifically break your legs, that narrows down the possibilities, but also informs you in detail.:)
So, step #1: If there is an opportunity, see if you can demotivate the potential attacker(s). This is a tricky game. Some attackers are just desperate and aren’t really looking to target you. If you can tap into the mode of “let’s solve the real problem”, great. But, sometimes they are set on committing a certain level of crime and will go all the way. Typically, such a potential attacker is looking to see fear in you. If your “hold on, let’s see if we can solve this” sounds like you are afraid, this may just trigger them, and you might instead have to make a gory example out of (one of) them (to discourage the others)—that would mean you are on step #3, below. So, it’s really touch-and-go.
If there is no safe way or time to handle the situation psychologically, then you must act. Step #2: See if you can make yourself inaccessible to the threatening party. “Run-fu is a perfectly legitimate option,” said one of my martial arts instructors. But, notice, the boldfaced statement of #2 is not limited to running. If you can put a locked door between you and the threat, or put witnesses where your threat was hoping to avoid them (by running to a public place, or smashing a window or otherwise attracting attention, etc.).
This, second, step may not be feasible. If you have your (untrained) SO, or a child, with you, their preparedness to move may not be enough for Step #2, and you are left with Step #3: Take actions of a last resort. That means, do what you can to defend your life and limb, and possible the lives and limbs you have taken on the responsibility of defending (e.g., if your kid is with you), appropriately to the threat. As anyone with minimal martial or military experience, or even just minimal lock with reality, will tell you, there are situations when you have no choice but to fight. So… you already started training, right? I’m sure you have.
Above all, remember: the only things worth saving are life and limb. Every qualified martial arts instructor will tell you that if the only thing needed from you is your wallet, then the thing to do is to hand it over.
Here are a few examples of different motivations to attack:
*) Your attackers were sent to threaten yo, and try to set you up with provocation first—a clear sign they have criminal intent: