There is a chip in the keyboard which may be toast. USB or wireless? PS or laptop? OS? Drenched in DR Pepper or Coke? Backed car over it?
If standalone keyboard - Remove device, reboot, shut off. Then tip keyboard upside down and tap the edges on desk top - top and bottom right and left - dislodge detritus - blow clear. Attach device, reboot.
Better?
If not, we need detail so we can really help.