View of the inside of a 3d printed mechanical keyboard. A small circuit board is at each key position. Ribbon cables branch out and a different wire runs along each row of keys, and each column.
https://digipres.club/system/media_attachments/files/112/223/697/016/524/282/original/e1d9c34c6f701e10.jpg