You’ve already done the right troubleshooting steps — especially testing the keyboard in BIOS. That’s important because:
If it fails in BIOS, it’s not a Windows or driver issue.
It’s almost certainly a hardware problem.
Since your Surface Pro 9 keyboard (Model 1905) stops working only when you lift it into the raised magnetic position. That usually happens because:
- This is a very common early sign of ribbon cable fatigue. or
- The connection points don’t stay aligned properly when the keyboard is bent. If possible, try attaching this keyboard to another Surface Pro 8 or 9, or test a different keyboard on your Surface. This will help isolate whether the issue lies with the keyboard itself (the more likely culprit) or with the Surface's connector (less common).
If under warranty, contact Microsoft Support if not. Replacement is usually the only permanent fix.