Oh boy... this was sort of an obsession of mine as a preteen. Not to say I know a lot about it, but I've asked myself this multiple times in the past. Before I say what I do know though, I should probably just point out that key mashing isn't everything. I haven't played games like STW where players are supposedly doing that, but in many games, hitting a key super fast is less important than overall reaction time and strategy. Admittedly some games do require fast key spamming (I'm looking at you, Crazy Party!) but we could discuss its minigame balance all day in another thread.
Anyway to the topic at hand. When I was first getting into playing audio games, I was around 11. And for games like Super liam, Blast Chamber and Troopanum (old classic control key mashers for those of you who don't know) I used to just scrunch two fingers on the control key, sort of tense my arm and just let my hand vibrate. I could hit the key pretty fast that way. Not for long mind you, but I got the job done. Then again I was focusing on the control keys then. It fell apart a little when I tried it with arrow keys, and the Troopanum 2 landing your ship bonus round was proof of that.
Then when I was around 13-14, I hurt my wrist playing Troopanum. Nothing remotely serious, in fact it felt better after about an hour, but I had a piano lesson that night and something in my head just said, "Hey that method for spamming a key is probably not wise). Sometimes I still try it, but, I've actually found since I was around 16 ish, I've not been able to do it as fast. I'm thinking that's more of a physical thing though, having to do with muscle structure and whatnot, since I never had to practice to get it fast initially. Come to think of it, practicing that method sounds painful to me now. I guess you could do it, but I wouldn't recommend it or I'd at least advise you to be really careful.
To date I've come up with two alternatives which don't require you to tense at all, and still let you get pretty fast.
1. Use two fingers alternating. I use index and middle fingers back and forth, with one finger taking one side of the key and the other finger taking the other side. If you have thin fingers it helps for stuff like the arrow keys which are smaller, but you don't need to squeeze your fingers onto a single key either. You want your fingers as close together as you can comfortably get them so that they're more or less centered on the key you want to hit, but they don't need to fight for space. Dexterity is more important here; when one finger strikes, it should immediately bounce back up to give the other finger room to come down. The more efficiently you can coordinate this back-and-forth, the faster you can hit the key.
Tip: If you take piano/typing lessons, they say to keep your wrists up... but for this method you don't want to do that. At least I don't. I rest the palm of my hand on the desk for support, allowing my fingers to curve up toward the keyboard, and pretty much just bounce the very tips of my two fingers lightly off the key I want to hit. It might be bad technique, but it isn't uncomfortable at all, if I stay relaxed and don't slam the keys down (force isn't what you need here).
This is obviously going to be easier with a mechanical keyboard, but I think any slim keyboard would work well enough. I'd be a little more worried about keyboards where the keys travel a good distance before registering a press. I haven't tried key mashing on those though, so I don't know how well they work or don't work for me.
2. Two-handed. Similar, but instead of alternating between two fingers, you alternate between both hands. Like you're trying to do a drum roll on your keyboard. Getting the coordination for that is a bit tricky sometimes, especially if you're hand coordination isn't good, but for me it's faster than any one-handed method I've tried. It wasn't always, but as I've gotten older I've gotten better at it.
3. And a bonus method, if you need to mash control, is to, well, use both control keys! But since the op mentioned arrow keys, that probably won't apply unless you can somehow map those actions to two keys and remember to use both when spamming lol
Edit: typos
Make more of less, that way you won't make less of more!
If you like what you're reading, please give a thumbs-up.