I have read enough formulas for writing to have utter conviction that there is no formula for writing outside of writing. A deaf adherence to a myriad of writing tips and hints can end up being poison in the system of your own creativity.
With that caveat established, I have found that when I lose my way in a narrative it often helps me to write the ending. I start writing a short story with a 1500 word limit only to be 2800 words in with nary a cohesive end in sight. At that point, I ask myself, where do I want this to go? What do I want to see happen? And then I write it down. I may even eventually change the ending, but I have found it helps me to plot a course when I can head toward a flag I’ve already staked.