Try the keyboard on another computer.
Try another keyboard on your computer.
Determine if the problem follows the keyboard or stays with the computer.
Keyboard make & model? Any drivers available versus stock Microsoft drivers? If so, download the applicable drivers via the keyboard's manufacturer's website.
If the problem follows the keyboard then the keyboard is likely broken.
But you might try cleaning it. Unplug and turn it upside down over a cloth and firmly but gently tap the ends and sides with the heel of your hand. Lots of crud likely to fall out. See if the keyboard works.
Next step is riskier. Pull the key caps and clean directly. You may be able to salvage the keyboard if the problem is just dirt and crud.
Especially if you eat while typing, have pets around, lots of paper on the desk, etc..