>>
Assuming the keyboard hasn't failed (which you can check by plugging in a $10 keyboard), more than likely either you or someone who physically has access to it spilled something on it.
If it's a detached keyboard, like you'd find on a desktop or all-in-one, you can shut the system down, detach the keyboard, let it sit for an hour. Fill up your bathtub part-way with hot water, dump a bunch of dishwashing liquid and squish it around, then dunk the keyboard in and pull it out and flip it upside down and dunk it in and pull it out and let it sit for a couple minutes then repeat the process a few times. Finish by draining your tub then running cold water over the keyboard for several minutes until its stopped blowing bubbles or run soapy white water out for at least a few minutes. Finish by letting it sit for a couple days. You can speed up the process by putting it on end in front of a box fan or the like. Another option is to buy a sufficient quantity of 99% pure isopropyl alcohol to fully immerse the keyboard, swish it around a bit to displace all the water created during the rinse, then pull it out. In a matter of 15 minutes or so the alcohol should have evaporated.
If you're on a laptop you're probably fucked unless you feel like disassembling the laptop to extract the keyboard from it for a similar cleaning process.
Another possibility, assuming you're absolutely sure that nobody has ever spilled anything on it is you've installed a virus and it's hooked into your keyboard driver (e.g. a keystroke logger) and its not working right because most malware authors don't know what the fuck they're doing (which is why they're writing malware). Easiest way to test this is to create linux media on a CD or USB drive and use the "live" environment to see if the problem still occurs.