The illusion works because of the “shadow” that falls on the checkerboard. Lets think of the square that the shadow falls on. Now picture that the shadow doesnt exist, you would see a light colored square surrounded by the dark colored squares.
But when the shadow falls on top of that light colored square, the shadow causes the shade to become darker but it also causes the surrounding darker squares to become darker. So within the shadow region the brightness and darkness of the squares are still relative to one another. But they are no longer relative to the squares that lie outside of the shadow.
So if you were able to pick up the middle square and move it to one of the outside dark squares, they would be 2 different shades. But the trick is ..that when you move the square you are moving it WITH the shadow still printed on the square. So now you’ve moved it out of its relative area, outside of the shadow region (but with the shadow still printed on the square) ..to the area where it’s the same shade as the “dark” square.
We put together a template of a smaller version of this design for you to download and try yourself.
Give it a try, it really is amazing to see it happen right before your eyes: