101 1 100
110 10 111
--- 11 11
011 100 100
101 ---
--- 100
001
If you know something about electronics, you may recognize
this as an XOR operation.
If you are playing Nim, write down the number of matches in each row in binary and do this operation. If you have a nonzero answer, you can always remove matches to get a zero result. If you get a zero answer, anything you do will leave a nonzero result. The winner, of course, leaves no matches at all, which is a zero result. So always play to leave a zero result for the operation.
If your position looks like this, you can win.
The operation is the middle example above. If you remove one match from either row 1, row 3 or row 5, you will keep the advantage.