I think what you are describing, is residual electric charge in the motor. This could be possible if:
- The shock only lasts a very brief amount of time (a fraction of a second.)
- The motor is rather big (the bigger the motor, the more likely this would be possible.)
- The motor was spinning, but is now stopped, and nothing at all is connected to the motor phases - no VFD's, no reactors, no capacitors anywhere - just the motor wires.
So to reiterate: I'm assuming the motor is connected, ran, and disconnected via a switch/contactor/breaker. When disconnected, nothing at all is connected to the motor.
The windings inside the motor have a small parasitic capacitance to the chassis. This is a physical property (the windings are coated in a very thin enamel insulation, thus the proximity of a winding to the chassis equates to two plates of a capacitor.) Which means that a tiny amount of electric charge could remain between one or more phases and the chassis if suddenly disconnected.
For small, low-voltage motors, this would likely not even be detectable or dissipates too quickly to measure. But on large, medium and high-voltage motors, residual charge might be able to give a noticeable "poke" for a short time.
Does current have to return to its source?
Current implies that electricity is actively flowing, but what we're talking about here is really static electricity. The motor is disconnected, and one or more windings retains a portion of it's voltage (charge) with respect to the chassis. This charge doesn't go anywhere immediately, because the windings are insulated. The electric and magnetic fields have stopped moving, but there is still a small charge present, waiting for an unsuspecting person to complete the circuit (between a winding and the chassis.) So in this respect, it could be looked at like a small capacitance between each winding and the chassis.
When that person completes the circuit, the static charge very rapidly flows through the person, giving them a shock. Only during the entirety of the shock, is any current actually flowing. When the shock is over, the winding voltage and chassis voltage are now the same - charge has been balanced - so no more current flows.
The solution to such a phenomena would be to simply touch (safely - insulated alligator clips) a "bleeder resistor" from chassis to each phase, directly at the motor's terminals. A 5-Watt resistor, value of 100 kΩ (a hundred thousand ohms) for 240 V, 220 kΩ for 480 V, 470 kΩ for 690 V etc, would dissipate that charge in under a second for all motors except the very largest ones. Do not run the motor with any such resistors connected, as it would tend to "electrify" the chassis. Do this only for discharging stored charge.
Curiosity got the better of me, so I just ran an LCR Meter (inductance, capacitance, resistance) test between chassis and a phase of a 300HP induction motor. Test reported 20 nF (0.02 µF) with a dissipation factor of 0.2, meaning it can store enough charge, long enough, to get a shock. For bigger and higher quality motors, I imagine this would be even more of a problem.