There is a switch under every square. I can see that.
At the open of the game the computer knows where every piece is because (there is only one way to set up the board)
When you pick up a piece the computer knows what is on that square. Then when you put it down. The computer knows there you placed the piece because that switch closes.
I don't see any magic here.
The magic is in the implementation of PGN and then the comms to the PC software playing the game.
8x8 switch matrix has to be parsed into PGN notation and then passed to the PC Chess software. Therein lies the difficulty. https://en.wikipedia.org/wiki/Portable_Game_Notation