user-1: 

I was wondering if this is the right way of how the threefold repetition works. Thanks. (The image is in gif format, it should play automatically.)

user11245: The confusion regarding the right to claim a draw when the position occurs 3 times results from the common misnomer for the situation: "Three-Fold Repetition".  A correct term could be Three-Fold Occurrence.
As a result, in your diagram, after there have been 2 repetitions (which shows in the animation as "Repitition (sic) 2", there have been 3 occurrences of the position, and a draw may be claimed.  The game is not actually "drawn" until a claim is made and the Arbiter or Tournament Director approves the claim. This also has the result that if the player creating the 3rd occurrence of the position neglects to make the claim and proceeds to make a move, the right to claim a draw for this situation expires instantly, with his move. 
Note that the protocol for making such a claim must be (to avoid causing his right to claim to expire) the following: The player announces his intention to make the move and cause the 3-fold occurrence, makes the claim to the TD before moving, and the claim is adjudicated. The rules do not describe whether the TD will require the player to make the move, but it would seem that he must, for the claim to be completed, or he will not have fulfilled his claim by causing the position to appear.  If it is determined (after the move has been made, presumably) that the position is not in fact a third occurrence, presumably his move must stand, and a penalty for incorrect claim would be levied.
Note that all of the legal moves in all of the 3 occurrences must be identical, including rights to castle as well as any possibility of en passant capture.  It is not sufficient that the same pieces merely appear on the same squares.

-1: <p><a href="https://i.stack.imgur.com/XNaw0.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XNaw0.gif" alt="Threefold repetition animation"></a></p>

<p><br>
I was wondering if this is the right way of how the threefold repetition works. Thanks. (The image is in gif format, it should play automatically.)</p>
 11245: <p>The confusion regarding the right to claim a draw when the position occurs 3 times results from the common misnomer for the situation: "<em>Three-Fold Repetition</em>".  A correct term could be <em>Three-Fold</em> <strong><em>Occurrence</em></strong>.</p>

<p>As a result, in your diagram, after there have been 2 repetitions (which shows in the animation as "Repitition (sic) 2", there have been 3 occurrences of the position, and a draw may be <em>claimed</em>.  The game is not actually "drawn" until a claim is made and the Arbiter or Tournament Director approves the claim. This also has the result that if the player creating the 3rd occurrence of the position neglects to make the claim and proceeds to make a move, the right to claim a draw for this situation expires instantly, with his move. </p>

<p>Note that the protocol for making such a claim must be (to avoid causing his right to claim to expire) the following: The player announces his intention to make the move and cause the 3-fold occurrence, makes the claim to the TD before moving, and the claim is adjudicated. The rules do not describe whether the TD will require the player to make the move, but it would seem that he must, for the claim to be completed, or he will not have fulfilled his claim by causing the position to appear.  If it is determined (after the move has been made, presumably) that the position is <em>not</em> in fact a third occurrence, presumably his move must stand, and a penalty for incorrect claim would be levied.</p>

<p>Note that <strong><em>all of the legal moves in all of the 3 occurrences must be identical</em></strong>, including rights to castle as well as any possibility of en passant capture.  It is <em>not sufficient</em> that the same pieces merely appear on the same squares.</p>
