Thanks for asking this great question, Sean.
You don’t need to know the ending before you start—in a moment we’ll look at some very famous examples. But you must know the effect you want to have on your audience, in order to create a satisfying and successful ending.
As writers one of the most important decisions we can make, is to select the style we want to work in. Selecting your style has enormous power. It is here that you select the effect you want to have. I have a page listing the different styles here. The ending to your story must pay off the effect you have chosen.
Let’s look at some famous cases of films for which the screenwriters considered different possible endings before picking the ones they are known for. We will see how the endings were changed to suit the effect they wanted to have on the audience.SPOILERS Don’t click a film title until you’ve seen the movie!
In these examples, the ending was changed to achieve the effect the screenwriter wanted to have on the audience.
So the answer is, while you don’t need to know the ending of your story when you first start writing, you do need to know the style of your story—i.e. the effect you want to have on your audience—so that you can craft an ending that matches that effect.
I hope this has been helpful.