The Surface Book has 2 batteries and the keyboard is removed by pressing the eject button on the keyboard. The eject function uses a muscle wire to release the catches, if the battery is below 15% the eject function will not work. Surface Pro 3 and Pro 4 keyboard are just pulled off, no eject needed.
If the keyboard is not responding, remove the keyboard and clean the contacts with a lint free cloth. There may be debris that interferes with the contacts. If this does not help then do a hard restart by pressing the volume up button and the power button at the same time until the computer shuts down.