It would seem that either the keyboard is faulty (has anything been spilled on it, ever?), or the data cable that connects the keyboard to the computer's motherboard is loose, possibly damaged.
You - or a technician, if you're not comfortable with it - can attempt to reseat/reinsert the keyboard's cable into its receptacle. If the keyboard continues acting up, it may need to be replaced altogether.