Most of the laptops have a magnet located in the LCD surround, usually in the top-right corner of the screen. When you close the screen, the magnet encounters a Reed Switch placed in the palm rest, resulting in a closed circuit. In general, all the operating systems are programmed in such a way that when the circuit is closed, they turn off the LCD or enter into sleep mode.