How to fix iPad Pro complaining about unsupported Apple Smart Keyboard?
The Smart Connector (three small pins) on the Apple Smart Keyboard is not forming a clean connection with the corresponding three-pin socket on the side of the iPad Pro.

Here are some ways to fix it:


Clean the contacts on the keyboard and iPad Pro 
Remove the Keyboard, restart your iPad Pro, reconnect the keyboard


More info can be found on this Apple Support document:
https://support.apple.com/en-gb/HT205237

However, this technique worked for me (it is not mentioned on the Apple support site):


Remove the Smart Keyboard
Put your thumbs on the plastic ridge behind the contacts on the
Smart Keyboard 
Gently push the Smart Connector outwards with your thumb, and with your fingers pull the ends of the plastic ridge on Smart Keyboard towards you so it slightly bends the ridge (moving the smart connector outwards).
Reconnect the Smart Keyboard


I did this and it formed a better connection between the Smart Connector on the keyboard and iPad Pro.

This technique fixed my Smart Keyboard and prevented the "Accessory not supported" error from appearing.

Images here showing the push and bend in my keyboard:
https://www.flickr.com/gp/185452511@N03/m444o6