If they converge on a climax. Sometimes you realize you have to put in stuff earlier to set up the climax and preclude other possibilities. And other times, the climax was the original inspiration and you are building back the supporting story to lead to it.
And then you have to try to recover your ignorance, and see where things are pointing to if you don't know where they are going. To ensure that you don't allude to things before your characters know them. To keep the events in doubt when, of course, they aren't in doubt, because you know where they are going.
It's one thing where putting the story on the backburner for a week, or a month or two, can help because it does help clear the details out of your mind. Besides, of course, letting you read what you wrote, not what you thought you wrote, so you can ensure that all the foreshadowing you thought was there was really there and says what you wanted to indicate. But it's very unlikely that you will forget the broad strokes of the story, like who wins in the end.
Love triangles seem to suffer from this particularly. You can tell from the start which character the heroine will end up with because the ersatz hero doesn't even have a splinter of attractiveness. He should be plausible. Indeed, probably he should be superficially more attractive so that you can have reversal of fortunes -- good old fashioned peripetia. But many a writer gives the wrong man hooves and a tail up front. . . .