Two possibilities :
1) Accumulated crud under the keys.
Place the keyboard vertically and gently tap it. In some cases, you may need to remove the key caps and clean under them.
2) Worn out keyboard or fault in the circuitry.
Buy a new keyboard. They don't cost much unless you want one of those fancy illuminated «gaming» model.
Electro
August 2019