There are many exercises to help improve your writing. One of these is taking the ending to a story you admire or like and altering it. The process is often used in the classroom to help get students thinking creatively or to add a personal touch to a work. While there is always the urge to create some bizarre new ending where it turns out the main character is a time-traveling alien with amnesia, creating a good ending requires a few constraints and a bit of planning.
Decide how far back you are changing the ending. Depending on the story you may have more room to work with if you go five chapters back versus only a few pages. You could also change the last few sentences to change the tone of the ending. As every story is different, figuring how far back to change the ending is completely up to you.
Avoid changing character's motivations drastically. If a character was secretly in love with another character for 90 percent of the story, do not make them suddenly switch to a new love at the end.
Change decisions of the characters. One of the best ways to change an ending is by simply changing a decision that a character wrestled with. This could be anything from whether to proclaim love to whether to shoot someone. The more important the decision the more drastic the ending should change. You could even change a very minor decision that could snowball into a completely different ending.
Change the outcome of an important event. If a particular character was stressed out, have your story put more pressure on them to have them react in a more drastic manner. Maybe they won't keep their cool or wits in your ending. If the character didn't take something very will in the original version of the story, consider making them take it very well.
Have the characters realize something earlier or later that they might not even have realized at all in the original story. Epiphanies will often have characters change the way they think about something and will affect the ending.
Add a brand-new scene or event. This can either be after or before the original ending. The things you can do with this are unlimited. You can shed new light on a character or event or explain something that wasn't talked about in the original story.
Write your new ending after you have finished planning and preparing.