When does the motor do that, in this circuit? Is it when the switch is powered off (by having GND to the base)? If so, if I do a PWM with the transistor switch, would it occur a hundred times a second?
The motor coil is an inductor. Inductors prevent current from changing quickly. As such when the transistor turns off the current wants to continue to flow out of the conductor. Without a diode it would have nowhere to go and the voltage at the open end of the inductor will rise to a very high value. The diode stops this by turning on when the end of the inductor rises above the supply voltage. This is usually termed fly-back. And yes, if you are turning the transistor on and off rapidly this will happen every time. As such, the diode needs to be able to handle your full motor current.
What does the motor really draw?
Some says it tries to pull a certain amount of current, thus driving the voltage way up high, until it gets what it wants (or unfortunately fry up something else). Is it right?
Some just says it creates a voltage difference.
DC motors pull a large current to start. This "in-rush" current is simply the voltage applied divided by the coil resistance. As the motor spins up, the magnetics inside the motor act like a generator creating a back voltage that opposes the applied voltage. If there were no load and no friction, eventually the voltages would match and the motor would reach a steady speed and take no current at all. However, there is always some form of load and friction so some current is required to generate enough torque to oppose those forces. The motor will stabilize at some speed that balances both of those effects.
They say that if we put a diode like that, and the motor inducts some current, the current will not be forced out from the transistor, but rather flow through the diode.
Then, is there no voltage difference between the (+) and the (-) of the motor (which is respectively the two nodes of the diode)? Current flowing without a voltage difference feels a little weird for me. Is it about the induction thing? I thought that the induction creates an electromotive force, which I thought of as a voltage difference. If the motor makes a reverse voltage spike, then I would need a resistor (in series to diode); if not, the high node is connected directly to the low, passing infinite current.
Thank you very much for your answers, in advance. I think I learned some electromagnetics years ago, but it's like a whole new thing to apply in real-world.
You have to stop listening to "they"!
When the transistor is on, the diode will be off, and current only flows through the transistor. When the transistor is off, and current is still flowing through the coil in the motor, the current will shunt around the motor through the diode. You do not need a resistor, because the current is already set in the inductor and can not rise. The voltage across the coil at that time will be pinned at the diode forward voltage.
The Missing Diodes
There is one more thing you should include in this circuit. You need a diode, pointing up, in parallel with the transistor too. (Note if you were using a MOSFET instead of a BJT, this diode is integral to the transistor and an additional diode does not need to be added.)
The reason for this diode has to do with that generator that is hiding inside the motor. When the power goes out on the circuit with the motor still spinning, Vcc voltage will fall, but the generated voltage from the motor will still be there and it will drive the top of the transistor to a potentially large, and damaging, negative voltage. A bottom diode stops that.
The motor will then hold up Vcc for a while, powering the rest of the circuit.
If it is a big motor with a large inertial load, that could be for some time, minutes even. You may want to prevent that from happening, as such, you would need yet another diode in the power line from the supply to the motors Vcc.
Those diodes also protect you from any unforeseen mechanical speed issues like a run away motor that will generate more voltage than Vcc, or a back driven motor.
Adding a Snubber
Finally, for completeness, you need a snubber circuit. DC motors are inherently electrically noisy due to the brushes making and breaking contact with coils through the commutator. There really is nothing you can do about reducing that in the motor itself, but you can limit the effect of that noise in your circuitry by adding a filter, called a "snubber", across the motor terminals. There are many variations of this, but as a minimum a simple RC filter should be included. If the wires to the motor are long, it is also prudent to add another snubber right at the motor itself.
Ultimately the driver would look something like this.
simulate this circuit – Schematic created using CircuitLab