It's very complex, and all I understand is what I have seen on the road. Not all shimmy is the tank slapper kind. On motorcycles, it's true high speed wobble that the rider causes with steering overcorrection. It's not the frame bending.
But on bikes, you can get wobble even at very low speeds, that is caused by the overloading of the bike. I'm talking about rear racks or panniers. This is why we push so hard to get people to carry the battery in the frame triangle if that is at all possible. Any sway in a rack will amplify it.
Loaded heavy enough, you can upset the balance of the bike with just pedal strokes, and every pedal stroke causes the rear load to wag like a dogs tail. If the frame is cheap thin alloy tube, you will see a definite flexing of the frame in every stroke. This flexing may actually be desirable for an unloaded bike. The old cromoly frames would whip like a spring with a hard enough stroke and riders loved this in a sprint.
But as ebikers, we need to think like cargo bikes. We need very stiff frames, so a steel mtb or beach cruiser frame is good, because the steel frames are stiff, even in the cheap bikes.
Lengthening the wheelbase really helps, which is why longtails kick ass as cargo bikes. My longtail has minimal tail wagging, until I load it with more than 100 pounds. At 75 pounds of load, it rides fine even at 30 mph.