please submit $5 for first answer.
Just kidding obviously.
In all seriousness: Why was the keyboard installed? If the laptop was damaged then it could be that there are other problems with it other than the keyboard.
As Alvine said, it could be a bad charger connection, or your battery is running low/not holding a charge (this is generally what happens with laptops)
Try booting in safe mode and running your antivirus (if you do not have one I highly recommend a combination of malwarebytes and microsoft security essentials as they are both free and highly effective). While rare, there are some bugs out there that will cause premature shutdowns.