Violent confrontation has consequences, even in school. At the very least, it attracts significant attention from authority which nobody wants. So it changes the bullying risk/reward calculation, at least for "conventional" bullying for "fun" (if they're after your phone/money/etc, you will need to put up more resistance to counteract the higher "reward").
If you get into a proper fight you will lose, however most bullying is verbal and even bullies have no interest in escalating it to physical violence if it risks yielding consequences (if not for the violence itself, but their other behavior, that might otherwise fly under the radar). So merely showing the intent to fight back will make them move onto another target.
Yes, this is completely different from gangs and I'm not talking about those. If your school has a gang problem, this advice won't help you. However below "gangs" there will generally be a clique of people that may engage in occasional verbal bullying (because it's fun for them and/or bolsters their social status) but otherwise generally do well in school and have no interest in jeopardizing that standing - therefore violence will not be in their best interest, regardless of whether they'll actually win the physical fight.
> You can't avoid bullies at school. If your plan is to defend yourself, then you better be able and willing to dish out extreme violence when warranted because that's what it's going to take
You can't avoid 100% of them. You can avoid 90% of them by being stronger/more difficult than the other targets.