No matter what the contest is, luck is going to play a part in it. There is a reason that the saying goes "better lucky than good", and why the term "beginner's luck" is so prevalent in our society. The reason is fairly straight forward when you think about it too, namely that luck, chance, or whatever you want to call it will find a way to interfere in everything that it can. This is why a lot of sporting events do a "Best of 7 games" series for their playoffs, to try and negate the impact luck has on the results. Other contests do single elimination, reveling in the energy that on any given day it could be the underdog's time to shine, and prevail over the 'better' team. So, let's talk about that.
After reading my intro, it shouldn't come as a surprise to you when I say that the better person doesn't always win a contest. It doesn't matter how much better you are then someone else, on any given day they could theoretically beat you. Look at the NFL play offs any year, where underdog teams upset their "superiors" with determination, amongst other things. Or, look to professional poker, where tournaments have gotten so big that even with all the skill that it takes to be a pro player, it is basically a crap shoot to see who comes out on top in the end. No, luck is a factor, and any time when you are looking at things in the short term, you need to understand that luck is going to be a factor. Which means that, to win, even the better team is going to need to catch a few breaks now and then.
So why am I talking about this? Well, for a number of reasons. One, the presence of luck is very prevalent in RPGs, and that is something you need to be aware of as a designer and a GM. Don't believe me that luck is prevalent? Look at what you use to resolve conflict. Yep, dice. Second, being aware of luck's presence, and I mean really aware, can help you determine just where things have gone wrong, or where they have gone right.
To start off with, lets look at luck and catching breaks from the GM side of things. Now, just for a quick and easy example, lets look at what causes a TPK (Total Party Kill). The biggest cause? I haven't done research, but in my experience is when the GM has messed up some aspect of the threat assessment for a fight. The second biggest cause, in my experience, is dumb luck. The group should be able to kill the bad guys. They should be able to win. Only they can't seem to pull it off. The fighter is having a bad night, constantly rolling misses, or worse, fumbles. This means that one of your groups damage dealers isn't doing their job, and so enemies aren't dropping anywhere near as fast as they should be. Your thief rolls crap on his back stab damage, whoops..there goes that opportunity to really drop someone. The cleric fumbles the concentration roll and can't heal someone. Everyone botches their saving throw against the Dragon's breath weapon. It doesn't matter how it happened, the fact is that the dice just totally killed the group.
Even worse, it might not be the PCs rolling badly, but your NPCs rolling well. That dragon just crit three times, that is probably at least one dead PC right there. In a L5R game, I watched the GM go a combat round with rolling less than 70 for damage on every PC. It was game over before the fight even got going, and the fight wasn't even supposed to be that hard.
But, why bring this up? Because you need to be able to recognize when this is going on, so you can deal with it appropriately. Now, what is appropriate depends on your group, but the point is that when the dice go south it is not your fault as the GM.
However, I mentioned game design as well as being important here, and it is. Different games try to handle the concept of variance in different ways. Some games give players the ability to reroll a set number of times per session. Some games use narrative control, so that the dice can't kill the players without it being part of th eplan. Some games just take steps to minimize variance, making it so that the player throws a whole bunch of dice out of which only one is relevant.
No matter what way you choose to tackle the problem in your game, it is something you need to pay attention to. After all, there isn't much worse than having a game fall apart because of a few crap rolls on the PCs' part, or exceptional on the part of the opposition.