This post may seem like it is focused exclusively on narrative heavy or story based RPGs and campaigns, but it isn't. This advice is good for any game, and is a great way to help increase the feelings of victory and tension at the table. That said, when you are doing a more combat heavy or dungeon crawl based game, you need to understand that setting the players up to lose is generally a faux pas. There are ways around it, sure, but you need to be careful. That out of the way, today I want to talk about why your game needs to have both wins and losses.
But Winning Is Fun
The first reason many GMs balk at the idea that their game needs to have losses in it for the PCs is quite simple.Winning is fun. Everyone at the table is there to have fun. Therefore it makes sense that winning all the time is a great way to have fun. Unfortunately, that isn't always the case. In a weird way humanity is wired to kind of need the bitter taste of defeat. If things go too well, we get antsy and paranoid. If things stay on a positive track we start to get disruptive. We don't stay content with what we have, we reach for more. We reach and we reach and we reach until finally, eventually, we reach too far and experience loss.
You see the same thing out of players as well. How many games or groups have you seen plummet to their demise because the PCs got overconfident after a series of wins that had each seemed impossible going into them? How many groups have GMs wiped because they didn't recognize that the heavy beat downs being handed to their toughest encounters weren't because the PCs were that strong, but because the dice were coming down favorably? In my 20 years of gaming I've seen both happen a lot, and some very good stories, characters, and campaigns came to unsatisfying abrupt ends because of it.
Lack Of Consequence Breeds Lack Of Care
The consequence sword needs to cut both ways for a game to work, and by that I mean it needs to work both for the GM and for the players and not spare anyone from its great and terrible weight. For players, a lack of negative consequences is a world without punishment or rules. They keep reaching further. They keep struggling for more. They keep doing absurd and stupid things. You ever watch a game where the players had figured out that the GM wasn't going to punish them for failing? Sure, it can be fun in an extreme power fantasy kind of way, but the game loses all sense of gravity. Who cares about fighting dragons if all that is going to happen if you lose is you'll wake up - with all your gear - and need to heal up for the next shot at it? What's the point of a story about leading the charge against the forces of darkness if the darkness can't possibly win? When the PCs mess up, make bad choices, or otherwise act in a way to set the world on fire the world needs to respond.
However, this doesn't mean it doesn't go the other way too. Often this is called Agency, but what it boils down to is that while the PCs failures need to have meaningful consequences, their success does too. The PCs should be consequential to the world they are in. After all, the world literally exists to entertain the people controlling them. A game where the PCs have no mpact on the story and all the big decisions are handed out by other people is not a place many players want to be. Some do, and that's fine, but most don't.
What this boils down to is that the players successes and failures need to matter. More than just that should matter, but those especially. However, for successes to matter, failures need to both happen and also matter. You need both, or neither is going to mean very much.
A Little Pain Goes A Long Way
The saying goes "once burned, twice shy" and it is true for gamers as well. You don't need a lot of loss to keep the victories sweet and the fun rolling in. You just need enough failure and loss to cement in the players' heads that loss is always a possibility. When the players lose, they'll remember it. They'll approach other situations with more caution, because they will know they can lose, and that you are more than willing to let them lose.
Let your players put their hand in the fire if they're reaching for it. Let it burn them. They'll remember that fire is hot a lot quicker and for a lot longer than they will if you just explain it to them.