Whether you work out what happens at the end of your story before you start writing, or discover what happens when you write the climactic scene, understanding why the scene is so important to the protagonist's story is critical to getting it right.
There are several types of protagonist, and they fall into four main categories: the hero, the antihero, the anti-protagonist and the false protagonist. This article won't go into the latter because that's a topic unto itself, but the other three are the more pertinent ones.
The antihero is someone who may be villainous in nature, and/or may have little or no scruples, and/or be morally bankrupt. They may be the hero of the story out of love or simply self-preservation, or perhaps vengeance, and they may do the right things but for the wrong reasons.
The hero is much more straightforward and well known, but is essentially everything the antihero isn't.
The protagonist (or the anti-protagonist) is the main character in the story. Anti-protagonists are often the villain of the story, but portrayed as the hero, while their adversary (who isn't strictly the hero) is depicted as the antagonist. A good example of this is Consider Phlebas by Iain M. Banks. What counts in anti-protagonist stories is not whether they win or lose, but how the story has changed them. The same could also be said of conventional protagonists, but it is emphasised for anti-protagonists.
By final scene, I am referring to the climax of the story, not the dénouement that may come after. There are all sorts of things that may or may not happen in a climactic scene. In most genres there is one tenet that should be repeated like a mantra until it sinks in:
The story must finish with the hero making a decision or committing an action that nobody else can, and that dramatically changes the ending.
Without this, the reader is left wondering why they've wasted so much time and effort reading the hero's story. It has become a let-down. Worse, you may have inadvertently repeated the Indiana Jones plot hole, the biggest and most famous plot hole in movie history: Jones does nothing to affect the story. With or without him, the Germans get the Ark, take it to the island and open it (and die). He doesn't even get the Ark sent to a museum, the only reason he got involved in the first place.
Indiana Jones is, in Raiders of the Lost Ark, irrelevant to the story.
If you have a climactic scene in mind before you begin writing the story, it is worth testing it to see if it complies with this simple but important rule. If not, then you should build into your story the ability for your hero to do what nobody else can. If you are a discovery writer and want to determine what happens in the scene at the time you write it, ensuring your hero has options to comply with this tenet will save a rewrite.
It is important to note there may be different ways the hero can 'do something that nobody else can'. It may be because they have a skill or ability nobody else has. It may be they lack the moral backbone and scruples, and can therefore can do what others won't (or by their nature, can't). It may be that at just the right moment, they find themselves in exactly the right place to do what needs to be done. Perhaps they understand the antagonist so well they can anticipate them sufficiently to thwart them when nobody else could have done. Alternatively, they may have had the foresight to bring an army to distract the antagonist's minions, a small group of companions to get them to the inner sanctum for the final showdown, and carry a spare knife for that moment they run out of ammunition and the antagonist unwisely starts to gloat.
The point here is that the hero doesn't need to be uniquely gifted. The plot is going to drive the protagonist to be there and equipped with whatever luck, skills, resources or whatever is needed to fulfil their destiny (or die trying). The story is about the decisions the character makes - some might be forced upon them - and how these decisions and the experiences the plot foists upon them accumulate to make the hero the man or woman of the hour (or more likely, the moment).
In a tragedy, the hero will likely lose their life, or have their life wrecked forever more. Why? Because they didn't learn the lessons their experiences up to this point have been teaching them - or understand the lessons but refuse to change anyway. The antagonist need not win: the tragedy is that the hero could have won and lived.
Does this mean the 'do something that nobody else can' rule changes or can be omitted? No, because this is what makes the hero the hero of the story.
Supposing the hero isn't the one to kill (if that's what is required) the antagonist? They can still be the hero if they distract the antagonist long enough for someone better equipped to do the job. Distraction is something almost anyone can do, if they're in the right place, so your protagonist might be generally cowardly but if they can develop enough backbone to distract the antagonist they can still be the deciding factor in defeating them.