Of course tactics play a part, as do formations, condition, player ability, etc, etc. But, if you've ever watched real football, you'll know that you can do everything right, dominate a game and still lose.
Check out Barcelona's result last night and look at the stats, if you doubt that statement.
The key is to decide what works and what doesn't and that takes several seasons of heuristic learning. You need to lose to work out how to win and even then it will probably just give you a higher % chance of victory. But it will never be 100%.
I've lost dozens of games I should have won. Sometimes there isn't a reason other than bad luck.