Regarding the competetive / e-sports games, there's a different kind of luck / randomness involved.
In Starcraft, a unit will always do say, 10 damage, instead of a random number from 5 to 15, so there's no randomness/luck in the raw mechanics.
However, it's a game of hidden knowledge where each player is acting on incomplete information, which means you have to fill the gaps in your knowledge with educated guesses. One of the skills of the game is making better guesses than other players, or performing better scouting to maximize the information that goes into your guesses.
If you're losing (the other player is snowballing), you can choose to incorporate more risk into your own strategy. For example, you could choose to gain the dark templar technology/units, which are invisible. If you're lucky enough to strike with these units before your opponent either scouts your base (where he can see the building that grants this tech/unit), or correctly guesses that you might do this, then you can outright win the game due to him not having built the counter -- an invisible unit detector. However, if he does build a detector, then your gamble will be worth nothing, and your opponent will continue to snowball while you've wasted resources on this attempt.
Even the opening gambits that you choose from are often quite luck-based. To simplify, say there were only 3 opening gambits:
A: rush attack (strong early, weak later)
B: safe and standard (balanced)
C: greedy economy (weak early, strong later)
If you choose A, you're on equal ground if your opponent chooses A, you lose against B, and you win against C.
If you choose B, you win against A, you're equal against B, and you're at a slight disadvantage against C.
If you choose C, you lose against A, you're slightly ahead against B, and you're equal with C.
All of them deliver an equal match 33% of the time (if your opponent executes the same opening), but if we exclude those fair games and look at the other 67%:
A is a 50/50 chance of winning/losing.
B is a 50% chance of winning, and a 50% chance of starting off at a small disadvantage.
C is a 50% chance of losing, and a 50% chance of starting off at a small advantage.
Logically, in isolation, B is the best option, followed by A, followed by C.
However, if we then know that B is the best option (and most common) option, then now A is the worst option, because B beats A outright.
So, if A is the worst (and least common) option, then C suddenly becomes the best option, because excluding A, it is always either equal or better for you!
But then if C is the best (and most common) option, then A becomes the best option, because it beats C outright.
And if A is then the most common option, then we're back to B being the best choice.
...and so on, around in a loop...
In practice, there's a near-infinite number of different opening strategies, but you can still mostly categorize them into the above three groups. Over time, different openings come in and out of fashion/popularity, which affects the statistical odds of each other opening being successful for you!
When playing against unknown opponents, you've got to use your own guesswork of general fashion at the time to evaluate which opening to use, and when playing professional e-sports, competitors will analyse their opponents' history to perform educated guesses of which strategies will work the best. You can choose to tweak your level or risk by tailoring a strategy, e.g. an opening that is mostly "B", but slightly "A" or slightly "C".