On the rear panel of the system unit there are two small round connectors keyboard and mouse ports are PS/2. These ports are very sensitive to a short circuit. If you happen to plug or unplug the keyboard while the computer is on, it is possible that the port has failed. In this case, the keyboard shuts off due to this fault.
This problem can be the bad contact. Turn off the computer, disconnect the interface cable from the mouse connector on the mainboard and carefully reconnect again. After restoring contact, the normal keyboard will work.
In installations of Windows have the ability to disable the device to save power. In "device Manager", expand "Keyboard", right click on the device icon and select the option "Properties" in the drop down menu. In the tab "power Management" uncheck the "Allow the computer to turn off this device...". If your keyboard connects via USB port, to prevent its disconnection is in the list "universal serial bus Controllers USB".
Is faulty can be the keyboard itself. If you ever spill liquid on it, perhaps there is a short circuit conductive paths within the device. You can try to repair the damaged areas using a conductive adhesive. To do this, disassemble the keyboard and rinse the film base, which caused track. After drying, using the tester, look for breaks in the electrical circuit. A pointed match or toothpick, apply the glue on the tape over the damaged tracks.
There might be a problem with the device driver. In "device Manager" right click on the icon "Keyboard" to bring up the contextual menu. Choose the Delete command. Press to confirm OK and then restart the computer. The system will detect the new device and install the driver for it.
Disconnect the keyboard may be a result of malicious activities of viruses. Run a deep scan of your computer antivirus program. Be careful when surfing the Internet.