Not 100% of the time. Sometimes the good guy flat out loses. Sometimes there may be a moral victory, but it’s not resolved into an actual victory.
There are two classic examples I can think of.
To Kill a Mockingbird - Atticus may have done a better job than any other attorney in history in defending Tom Robinson, but he still lost the case. To make it worse, Tom tried to escape and was killed.
Rocky (the first) - Yeah, Rocky’s whole goal was just to get to fight in a real championship bout, and he put up a good fight, but he still lost. If the movie hadn’t been so successful to make Rocky II possible, it would have ended right there.
Of course there are tragedies like Romeo and Juliet, where the heroes not only don’t win, they end up dead. Maybe the families made up, maybe they didn’t.
A recent clear cut example is Avengers: Infinity War, where Thanos emerges victorious and wipes out half of life in the universe.
For less clear cut examples, the slasher movies of the 1980s (Halloween, Friday the 13th, Nightmare on Elm Street) typically end with the villain being defeated only temporarily. They are always revived / resurrected for the next sequel.
The Parallax View Not only does the hero NOT expose the assassination conspiracy, he gets killed and framed for a different assassination. And his friends that helped him get killed, too.
More spoilers, but the film Miracle Mile. It’s set up as a traditional romance/adventure film where probably everything will end up okay for the protagonist. Then at the end it doesn’t.
The Empire Strikes Back. The first act features the Rebellion being routed from their main base, and being forced to flee. By the end, Luke has abandoned his Jedi training too early, and been defeated by his foe (losing his hand in the fight, and coping with the revelation that Vader is his father), and Han has been frozen in carbonite, and hauled off to Jabba the Hutt. Not a happy ending at all.
But, like Avengers: Infinity War, mentioned upthread, the losses are there to set up the victories in the next film.
As I’ve mentioned frequently here (and did so recently), in C.S. Forester’s novel The African Queen Charlie Allnut and Rosie fail in their effort to sink the Louisa, unlike the movie. The Louisa is sunk, but not by their efforts.
Beneath the Planet of the Apes Taylor explodes the Doomsday Device, killing every living thing on the planet. (Dr Zaius was RIGHT! Man IS a danger.)
The Omega Man Neville dies at the end, but at least maybe humanity has a chance. So maybe the hero won. Or maybe not. Evil was doing pretty well at the end of the film.
Soylent Green I’m said before, just because Thorn yells the famous phrase, I don’t think it will make a difference. The oceans are still dead, humanity is still dying.
The 70s were really big on this. And they loved casting Heston.
I wouldn’t quite call this “losing,” but I’ve always appreciated how the movie Crazy Heart doesn’t end with the hero getting the girl. He gets his shit together, fulfills his quest to stop drinking, find his muse and start writing songs again, and… it’s too late. She’s moved on. And that’s OK, because she is a human person with her own arc and her happy ending doesn’t involve him. And he accepts it, because as he acknowledges, she deserves the good man she’s now engaged to. It’s so unsexist it still makes me misty-eyed.
You reminded me of another one from that era: They Shoot Horses, Don’t They?
It takes place during the Great Depression. The main characters (played by Michael Sarrazin and Jane Fonda) are competing in a dance marathon, hoping for the cash prize.
By the end, they discover that the winning prize will be much smaller than promised, and they drop out of the competition; Fonda’s character becomes despondent, and begs Sarrazin’s character to kill her. He shoots her, and is then hauled off by the police.
Vanishing Point I’m not sure what Kowalski was trying to do, but dying in a huge fireball crash probably wasn’t it. I’m pretty sure he wasn’t trying to commit suicide. I think he saw the V formed by the bulldozers as the titular escape. He thought he made it. Right until the last second.
Cool Hand Luke I’ve never been a fan. I just don’t think dying to prove you can’t be “tamed” is any kind of victory; moral, spiritual, or whatever. Yes, Luke, you sure showed them! I’m sure The Man forgot by dinner time.