Pin (chess)

In chess, a pin is a chess tactic in which a defending piece cannot move without exposing a more valuable defending piece on its other side to capture by the attacking piece. Moving the attacking piece to bring on the pin is called pinning; the defending piece so restricted is described as pinned. Only pieces that can move an indefinite number of squares in a horizontal, vertical, or diagonal line (i.e. bishops, rooks, and queens) can pin. Kings, knights, and pawns cannot pin. Any piece can be pinned except the king, since the king must be immediately removed from check under all circumstances. It is like a skewer, but in a skewer, the more valuable piece is the one under direct attack. The opponent is compelled to move the more valuable piece to avoid its capture, thereby exposing the less valuable piece which can then be captured.
Types.
Absolute pin.
An "absolute pin" is one where the piece shielded by the pinned piece is the king. In this case it is illegal to move the pinned piece out of the line of attack, as that would place one's king in check (see diagram). A piece pinned in this way can still give check or defend another piece from capture by the king.
Relative pin.
A "relative pin" is one where the piece shielded by the pinned piece is a piece other than the king, but typically is more valuable than the pinned piece. Moving such a pinned piece is legal but may not be prudent, as the shielded piece would then be vulnerable to capture (see diagram).
Partial pin.
If a rook or queen is pinned along a or , or a bishop or queen is pinned along a , the pin is a "partial pin": the pinned piece can still move along its line but cannot leave that line. A partially pinned piece can break its own pin by capturing the pinning piece; however, this can still be advantageous to the pinning player, as in the example diagram (the pinning rook is defended, so capturing it with the queen would lose ).
A queen can only ever be partially pinned, as it can move in any linear direction. Pawns are a more complex case; due to its limited and conditional movement, whether a pin on a pawn is partial depends on both the line and direction of the pin, as well as whether there are opposing pieces available for it to capture.
It is possible for two opposing pieces to be partially pinning each other. It is also possible for one piece to be pinned in one direction (line of attack) and partially pinned in another, or otherwise pinned in two or more directions.
Situational pin.
Sometimes a piece may be considered to be in a "situational pin". A situational pin is not an absolute pin and the pinned piece can still legally be moved; however, moving the pinned piece out of the line of attack can result in some detriment to the player (e.g. checkmate, immediate loss of the game, occupation of a critical square by the opponent, etc.).
Consider the diagrammed position, it is White's turn to move. The black bishop on d5 is unprotected and White can capture it with 1.Nxd5; however, White should not play the capture or otherwise move the knight, due to 1...Rb1+ winning White's rook (the king is forced to move, exposing the h1-rook to a skewer attack). It can be said that the white knight is "pinned to the b1-square" rather than pinned to a piece.
Pin combinations.
Pinning can also be used in combination with other tactics. For example, a piece can be pinned to prevent it from moving to attack, or a defending piece can be pinned as part of tactic undermining an opponent's defense. 
A pinned piece can usually no longer be counted on as a defender of another friendly piece (that is out of the pinning line of attack) or as an attacker of an opposing piece (out of the pinning line). A pinned piece can still check the opposing king, however, and therefore can still defend friendly pieces against captures made by the enemy king.
Unpinning.
The act of breaking a pin is "unpinning". This can be executed in a number of ways: the piece creating the pin can be captured; another unit can be moved onto the line of the pin; or the unit to which a piece is pinned can be moved.
Although a pin is not a tactic in itself, it can be useful in tactical situations. One tactic which takes advantage of a pin can be called "working the pin". In this tactic, other pieces from the pinning piece's side attack the opposing pinned piece. Since the pinned piece cannot move out of the line of attack, the player whose piece is pinned may move other pieces to defend the pinned piece, but the pinning player may yet attack with even more pieces, etc.
Pins commonly seen in gameplay.
A pin that often occurs in openings is the move Bb5 which, if Black has moved ...Nc6 and ...d6 or ...d5, pins the knight on c6, because moving the knight would expose the king on e8 to check. (The same may, of course, occur on the other flank, with a bishop on g5, or by Black on White, with a bishop on b4 or g4.)
A common way to win the queen is to pin her to the king with a rook: for instance with the black queen on e5 and the black king on e8 and no other pieces on the e-file, the move Re1 by White would pin Black's queen.
Examples from games.
The diagram shows Vladimir Lenin–Maxim Gorky, Capri 1908, with White to move. Black is threatening the following rook sacrifice and : 
White cannot play 27.gxh3, because the queen on g3 is pinning the pawn to the g-file. The only move that postpones the mate is 27.Nf4, which temporarily blocks Black's bishop from protecting his queen, but to no avail as Black can simply play 27...Bxf4 renewing the mate threat. Or, Black can respond by mating a different way: 
In this case, White cannot capture 29.gxf3 because the queen now on h2 pins the pawn to the 2nd rank. With mate being inevitable, White resigned after move 26.