You probably balked as soon as you saw the title of this article. After all, if the player gets too frustrated, they might abandon the game. Too many players abandoning the game could lead to bad word of mouth and people passing up your game without trying it. So why would I tell you to annoy your players? The answer is tension.
Remember, plenty of popular and well liked games punish the player quite a bit for failure. In Persona 3 and Persona 4 save points are scarce and a single random encounter that you handle badly can cost you hours of progress. In the Dark Souls series dying causes you to lose your souls (currency used to buy items and upgrade your character), and places you in a weakened state that it takes work to recover from. In any of these games, one mistake can cost you hours of progress. This seems like a textbook example of how to frustrate the player into leaving, and yet these are extremely popular games. Why?
Once again, tension. In Persona 4 if a tough shadow ambushes me at the end of a long dungeon delving session, I will be at the edge of my seat for the entire fight. In Dark Souls if I manage to accumulate a large number of souls, I’ll be looking over my shoulder every few seconds with my heart pounding until I manage to make it back to a bonfire to spend them. The adrenaline that you get in these situations adds a huge amount to the excitement of the gaming experience. The moments you’ll look back on when you think about the game will be the times you just barely avoided losing progress, or the times you just barely failed to avoid it. I’ve talked before about making the player make interesting choices, and consequences go a long way toward making choices interesting.
There is, however, one very important thing to remember when implementing a form of annoyance, and that is fairness. I mentioned Dark Souls specifically because the combat in that series is extremely well balanced. I die a lot every time I play Dark Souls, but every time I die, I know that I did something wrong, and I generally have an idea of what it was. This is important. The player will be far more forgiving of frustration if they can tell that they could have avoided it. Avoidable irritation motivates players to think about what they could have done differently, and makes them want to work hard to master the game.