Lightly lift up on the keyboard from one of its top corners and pull it towards the screen so you can safely remove the ribbon cable.
At the base of the ribbon cable, there is a tiny tab that runs across the width of the connector. Flip it up. You can now pull the ribbon cable free with no resistance towards the monitor.
With the cable unplugged, the keyboard can be lifted away from the laptop.