The powerplay is a moment in the game where a player of either team serves a penalty and when the other one gets to attack for the length of said penalty with a one man advantage the numerical advantage. Depending on the number of players on the other side serving a penalty, it can be a five-on-four (one man penalized), a five-on-three (two men penalized) or a four-on-three (two men penalized on one side and one on the other). While more than two players can serve penalties at one time for one team, there will never be fewer than three players on the ice for that team, no matter how many players are in the penalty box. Should both teams simultaneously have as many players penalized, there would be no powerplay for either side, as this situation only applies when there is a different number of skaters on either side. However, there will be a short powerplay for either side if the players currently serving penalties have not been punished at the same time on the same play; the difference of time between the end of the first penalty called and the end of the second will result in a powerplay of that amount of time for the team that had been penalized first.
The difference of player is the essence of the penalty, as it gives the advantaged team (i.e. the one benefiting the powerplay) extra chances to score - it is more difficult for the penalized team to defend itself when it has fewer players on the ice than the opposition. Should the powerplay team score a goal, the penalty to the other team would immediately cease and the serving player would be allowed to go back on the ice. In case of a five-on-three, it would take two goals for both penalties to be canceled (one goal would cancel the first, but the second would still carry on until the time is fully elapsed or until a second goal is scored).
Powerplays do not occur with every penalty. For instance, major penalties will not trigger a powerplay - the punished player will serve its entire 5 minutes no matter what happens (unless of course said penalty is bound to end after the last minute of play, for instance, a major penalty called with three minutes to go in the game). Same goes for misconducts, who do not trigger a powerplay.