Hi, sorry to tell you that if some keys are not working and some other are working it is 99% hardware problem.
If you spilled something on the keyboard it could be the problem. It doesn't matter how much water (or whatever) if it has reached the contacts it spoiled them.
Solutions: you buy a new keyboard, fast but very expansive (too much).
You replace the keyboard as I did, difficult, but very cheap.
You sell your surface and buy a new one.
You use it with a Bluetooth keyboard (there is a Microsoft foldable keyboard that is very slim, it would be perfect. When my keys were not working I was using it over the original keyboard)
If you spilled something on the keyboard it could be the problem. It doesn't matter how much water (or whatever) if it has reached the contacts it spoiled them.
Solutions: you buy a new keyboard, fast but very expansive (too much).
You replace the keyboard as I did, difficult, but very cheap.
You sell your surface and buy a new one.
You use it with a Bluetooth keyboard (there is a Microsoft foldable keyboard that is very slim, it would be perfect. When my keys were not working I was using it over the original keyboard)