I’m thinking mainly of stage musicals, but it can be any movie, musical, stage play, or what have you.
There are plenty of cases where the original book, play, or whatever had a downbeat, unhappy, or unresolved ending, but they clearly changed it because they wanted the audience to go out feeing good about things.
The example that first started me thinking about this was Agatha Christie’s Ten Little Indians/Then There Were none/(Ten little Nigger Boys), the one that started the trope of "One of the people on this island is a murderer, killing the rest of us off. In the novel, all of the people brought to the island have a dark, seriously guilty secret, but the judge responsible for the setup wanted to see them all punished, and so each gets killed off. In the stage play, two of them turnm out to be not really guilty. And wouldn’t you know it, it’s the Attractive Young Man and Attractive Young Woman who have fallen for each other, so they go off arm in arm at the end. Awwww…
But I realized they did this a lot. In Shaw’s original play Pygmalion, Eliza Doolittle goes off with brainless Freddy. In the first film version, with Wendy Hiller and Leslie Howard, Eliza comes back to Professor Higgins. She does in the musical My Fair Lady, as well, and in the movie they made of it.
In the novel Wicked (as in all versions of The Wizard of Oz) the Wicked Witch of the West gets dissolved (“You Liquidated her, eh?” says the Wizard in the 1939 film), but in the stage musical Wicked she fakes her own death and survives.
Similarly, although the Phantom of the Pera survives in Gaston Leroux’s original novel, he generally dies in movie interpretations (including Lon Chaney’s 1925 silent film). But in Andrew Lloyd Webber’s musical he survives (and even went on to a sequel musical).
The 1995 film of The Scarlet Letter twists the novel severely out of shape, most notably by giving it a pretty happy ending, with Dimmesdale and Hester both living and together at the end,
Similarly, the silent film The Sea Beast, based on Moby Dick and starring John Barrymore, has him not only surviving, but coming back to live with his sweetheart (!!!) The mind truly boggles.
The ending of The African Queen differs from the C.S. Forester novel. In the novel, Charley and Rose’s scheme to turn the African Queen into a torpedo to sink the German ship Louisa doesn’t succeed.Interestingly, the film made one change for the worse - in the novel the Germans don’t try to execute them, but turn them over to the British. But, of course, in the film they don’t end up being executed anyway.
I realize that there are plenty of cases of stories being altered from the source material, but I’m looking in particular for cases where the change was introduced precisely for that Happy Ending.
As proof that this has been going on for a long time, consider this – for over 150 years Shakespeare’s ultra-tragic play King Lear was performed in a drastically altered way, The version by Nahum Tate has Lear restored to his throne at the end, and Cordelia marrying Edgar. Tate’s version was phased out from 1823 to 1845, and rarely performed today
(To be fair, though, the source material – Geoffrey of Monmouth’s History of the Kings of Britain actually does have Leir restored to the throne. Shakespeare made the original story even bleaker.)