You have restarted - but have you attempted a forced-restart? Disconnect your iPad from the Magic Keyboard, force-restart, then reconnect the iPad and Keyboard.
- On an iPad with a Home button: Press and hold the top button and the Home button at the same time. When the Apple logo appears, release both buttons.
- On other iPad models: Press and quickly release the volume up button, press and quickly release the volume down button, then press and hold the top button. When the Apple logo appears, release the button.
This support page may be helpful with troubleshooting:
If you can't connect your Magic Keyboard, Magic Mouse or Magic Trackpad to your Mac – Apple Support
If you continue to have difficulties, you might be well advised to seek assistance directly from Apple Support. You will find the Get Support link at top-right of this page.
Alternatively you can make contact using the excellent Apple Support App:
https://apps.apple.com/gb/app/apple-support/id1130498044