Not so magic
Why is my Magic Keyboard not working?
Connect it to a USB port on your Mac using its Lightning cable. If it still doesn’t work over a cable, it has failed, so contact Apple Support. Otherwise, in Bluetooth preferences turn on the menu bar icon; use it to check the keyboard’s battery level. Fully charge it. The keyboard should then work without the cable.