3
Repetition
I had 2 earlier . He had a second left, I deliberately avoided a third and a draw was awarded for repetition

Threefold repetition is when the same position arises 3 times in a game with the same player to move. Also, if castling or en passant is legal for one of the positions for one side, it must be legal in the other 2 as well.

Actually it's threefold repetition of the EXACT position - with the SAME player to move, and the same RIGHTS three time (same castling rights for both players, same en passant rights for both players).
The threefold repetition doesn't have to be consecutive - for example, you can have a position occuring on the board on move 41, and then appearing again on move 48 and again on move 50 - that does it.

It's repetition of a situation not excactly repetition of the exact position.
What?

I had 2 earlier . He had a second left, I deliberately avoided a third and a draw was awarded for repetition
This game https://www.chess.com/livechess/game?id=1494240974 ?
Threefold repetition of position after moves 53/55/57
So I had the rule wrong.
I thought it was repetition by both players 3 times. However it is the same position repeated 3 times. So I repeated the same position once but because my opponent did it again it's a draw.
I am convinced I have done that before and it hasn't lead to a draw but I must be wrong!

I also had situations where SURELY the same position appeared for the 3rd time, but nothing happenend. Sometimes "claim draw" appears instead of "offer draw", but not everytime I'm expecting it.
When the same position (with the same player having the move) appears for the third time a draw may be claimed. In online chess the button apparently changes from "offer" to "claim"). In live chess it does not change, but pressing it will lead to a draw if the conditions are met.
If you make the move which creates the 3 fold repetition then press the draw button before your opponent makes his move. If your opponent makes the move which creates the 3 fold repetition then you can press the draw button immediately.

But pay attention - in FIDE rules for competitive OTB play, you need to claim the draw BEFORE making the move that brings about the threefold repetition.
You need to write that move down on your scoresheet and call the arbiter. You tell him that you're going to play this move, and that it will bring about threefold repetition.
Your clock keeps running. The arbiter checks your claim. If you were right - it's a draw. If you were wrong - you must now play that move that you've written.
If you first MAKE the move that creates the threefold repetition and THEN notify the arbiter - it doesn't work. Your opponent can deviate and play for a win.
There is even more to say about this seemingly simple rule:
1. Our language in this area is confusing; there may be a draw when the same position arises for the 3rd time. This means only 2 repetitions as the original (first) occurrence is not a repetition. It is quite common though - even amongst experts - to speak of 3 repetitions while there are actually only 2. Players also make mistakes with this rule which implies you can only safely repeat a position once. The second repetition can already lead to a draw.
2. It is useful to understand what RIGHT means. When you play 1.Nc7+ and black must give up his castling right by playing his king, you can argue there was no castling right in the first place. After all, there was no way black could ever castle after Nc7+. Nevertheless, the position after the subsequent moves 1...Ke7 2.Nd5+ Ke8 3.Nc7+ is considered DIFFERENT allowing for 1 extra repetition. Therefore, castling RIGHT must be considered as a "statutory" or "static" property. It's only requirement is that King and Rook have not yet moved in the game. I believe the same principle must be true for the e.p. RIGHT but I know of no FIDE ruling on this.
3. In the world of chess composition a complex claim procedure which involves not just moves but also players and arbiters is funny as these personae do not exist there. This is relevant in certain types of retrograde problems which take advantage of the repetition rule. Instead, some decades ago a convention was introduced which automatically draws after 2 repetitions. A few years ago FIDE added the 4/5-rep automatic draw to facilitate computergames. I haven't followed recent developments but it is fair to assume the retrograde world still sticks with its convention.
How many times before a draw?