How do Android tablets use magnet to auto-lock the device? Can someone explain how tablets like Nexus 7 detects a magnetic cover closing? I have tried putting magnets over the spots where the magnets in the cover are, but it will not lock. How does the tablet know if it is a cover?
Your magnets are probably in the wrong place. The Nexus 7's magnetic cover sensor is not along the right-hand edge, where the magnets that hold the cover closed are. It's in the bottom-left corner of the screen, about 2 cm from the left-hand rim of the device, and 4 cm from the bottom rim. Put another way: with the device in the "camera-uppermost" orientation, with the stock home screen displayed, the icon at the left-hand end of the tray is in the right place.

You also need a pretty strong magnet. Most fridge magnets aren't strong enough to trip the reed switch, but a Buckyball will do it (if you can still buy those where you are).