[I thought I might be ninjaed, but safely ignoring the Ant explanation. Unless it's Langton's Ant.
]
Having delved into a few keyboards, I might suggest it
could just happened to land on one of the tracks which serves a row/column/cluster of keys (when that includes various meta-keys, it can cause confusion as it thinks ctrl, shift and/or alt are pressed and doing things with the 'regular' keys that you might not appreciate), but even with the nature of jam (high-sugar semi-liquid that might resist drying out) and the tendency for most KBs being manufactured with minor spills/sweaty fingers in mind[1] I'm more inclined to think it's more a wider mechanical issue, probably nothing particularly to do with that jam.
If you dropped jam on it, the chances are you dropped other things in (biscuit crumbs, dandruff... though head hair[2] seems to be my main one for long-time used keyboards that I don't clean enough because I don't expect others to want to use them). With full peripheral keyboards it takes a
lot to jam (NPI!) things up[3], and shear mechanical wear[4] is more likely. With laptop ones, the 'pantograph' mounting (one version of key attachment above the sprung electrical contact membane that might be used) is very delicate bits of plastic and can be jammed slightly too closed or slightly too open, again sometimes creating odd effects, though 'dead key' and undue rrrrrrrrrrrrrepetition behaviour is the usual symptoms.
I
have had keyboards where something (maybe the IC that translates contact info into the "what is/are pressed" signal to the mobo) has sometimes thought that a key (the AltGr, maybe, i.e. the 'right Alt' for those who don't have it as anything as special is pressed even when it definitely is mechanically not. If it
is AltGr, it actually does much less than you'd expect (not everything that the normal Alt does), but some things react with it (it's how I get the € symbol, but it's the more esoteric Shift-Alt-scoping behaviour that usually tells me when it's gone wrong). When something seems wrong I'll press and release it and the (as I presume) keyboard controller chip goes "pressed? I thought it was already pressed... And now it's released..." and then things are back to normal. I tend to just hit-release both shifts, both alts, both ctrls, both 'Windows' keys and the 'Windows menu' keys, by rote, though, just to 'officially unpress' whichever single one of them may have been logically-only 'stuck', unless it's obvious which one it is.
Restarting the PC (without touching the troublesome bits of the keyboard) also seems to clear it, so there are at least
some instances where it was never physical stickiness.
Ach, I'm trying to cover all the bases here, and making it all much too complicated, I know. In short: see if you can get any strands of hair out of the keyboard (can be awkward, if it's moved under the keytops and not just lying along the key-'cracks' between rows/columns), check for 'avalanches' if you incline your board/laptop (with power off if the fan's too loud) and if any key feels slightly funny then that might be going/about-to-go either with dandruff/sugar/salt or a dodgy bit of ridiculously small bit of plastic that
is replacable (but whether you should try or not is beyond my remit to suggest).
[1] But if you somehow periodically have condensation on a closed screen, KZ, I'd suggest something a bit more troublesome.
[2] I presume. It's not particularly short and curly... Not that I can imagine anything below the neck gets a chance to drop in there, anyway, and it's not obviously the colour of my facial hair either.
[3] I remember one keyboard, in a place I worked at many years ago, made a notable 'avalanche' sound when held up and tilted. It wasn't broken, but I opened it up anyway when the person wasn't using it for a while and it had a lot of fine white crystaline grains in it. I didn't test it (especially not
taste it to see if it was either sugar (spilt in one or few instances of preparing a desktop coffee?) or salt (
maybe snack-based, but possibly also the remains of many slight amounts of finger-sweat?) or whatever-else-it-might-have-been... But I felt better after emptying it out. (Modern keyboards seem to have in-built 'drainage' holes to deal better with spilt liquids, which would have helped with granuals too, but this one was not designed so usefully and needed a flat screwdriver and some careful persistance to open up enough.)
[4] One computer has not only had most of the (commoner) keytops wiped clean of the printed characters (luckily I'm fairly good at my own variety of touch-typing, at least on a physical keyboard) but a number of them have worn so much from use that there's a hole in them where I've effectively rubbed them through to the inner void of the keytop.