I am a discovery writer. I agree with Liquid, I don't leave it alone. If I get stuck, I edit my story so far. I will start reading, from the beginning, and if I see anything worth fixing, I do.
If I finish and don't have an idea, I'll start over. If I go weeks without thinking of the solution, I'll still do that.
I feel like my only choices are to drop the story completely, give up on it, or read until I know how to fix it. What to cut, What to add, How to change the past to fix the dead spot.
I've read 200 pages four times through before figuring out how to fix it and finish the story. Sometimes it is a realization about a character (who they should be, what they could've done). Sometimes it is a realization about where I screwed the plot.
Stephen King, writing The Stand (823 pages) had a similar problem for weeks on end, and eventually scrapped a few hundred pages to start over at the particular point where he finally realized he'd taken a wrong turn.
You've got a story. If you are stuck, you got yourself there, with an earlier mistake. Keep reading until you find it, and then fix it. Question every plot development, twist or turning point decision you made. Question whether you've made your characters too soft, or hard, or conveniently too smart or too clueless.
You have the ending in mind. Try a reverse-writing: What is the final scene before that ending? The final discovery, the final piece of the puzzle that leads to that. If it is a battle, what happens right before the battle? Who is standing there? Who makes the final decision to risk their lives?
Then back up another scene. How did they get to THAT point? Eventually, you will find the seam between what you have already written, and what needs to come next. Then you can revise what you have already written to make that flow seamless.
There is something you can fix to make the story flow naturally into the ending. If you are going to be a discovery writer (and I am incapable of writing any other way) you have to get used to the fact that you can take a wrong turn, and are probably going to have to scrap a chapter or two now and then. Or more, like Stephen King, who scrapped about 25% of a book in progress, but finished it. I believe The Stand is his all-time bestseller.