Debate not fighting
All debates are arguments, not all arguments are debates. We aren’t here to address mindless shouting or simply attacking the other person. In a debate each side has a specific claim they’re trying to defend and advance, and is putting forward evidence for their side or rebutting evidence on the other side.
When two people disagree, why should they bother talking through the merits of each argument and trying to solve it? Why not just shrug, agree to disagree and move on?
To convince your debate partner
Sometimes you want to change the mind of the person you’re debating with. Maybe their viewpoint is harmful, perhaps you’re trying to coax them to your side, or just trying to formulate a plan together. Agreement allows individuals to work together, and often a team is more than the sum of it’s parts.
To convince the audience
When the person you’re debating can’t be convinced (and may be arguing in bad faith) it can still be valuable to debate them to convince the audience (that is, any onlookers) to come to your side. This is why there’s value in debating people who appear obviously wrong or who have no intent of changing their mind - you might change the mind of the audience. When your goal is to attack an idea, converting some of it’s adherents is better than none.
How to debate
In general you want to establish a clear back and forth flow between the two participants. Each side takes a turn introducing a piece of evidence, the other side accepts or argues against the evidence, and the presenter gets a shot at responding to the argument. The evidence gets added to the debate if both sides accept it, or gets parked to the side if not.
This is easier said than done. We presume both sides are acting in good faith, and have the same standards for evidence. When one side acts in bad faith or has a poor standard of evidence, the chance of a genuine debate in which one convinces the other side is poor. Debate in these circumstances is only of benefit to convince onlookers.
To be genuine, from the latin bona fides. In debate, to act in good faith is to only present evidence you believe is true (as opposed to intentionally misleading or wrong), to be consistent in your arguments and to generally follow decorum. The opposite of Good Faith would be bad faith (intentionally misleading, presenting bad evidence).
Examples of bad faith would be to reject all evidence you don’t like, to dismiss an argument due to appearance instead of merit or attack your opponent based on their nature instead of their arguments.