Now, the documentation tells me that the millis function goes back to zero about every 50 days. What happens to a delay that is issued before the function millis goes to zero again, but which would have expired after the reset. It seems such a delay would never terminate.
The correct technique is to note the current time (in an unsigned
long) eg. when you turn the motor on.
unsigned long motorOnTime;
motorOnTime = millis ();
Then you check, using subtraction, if that time is up. That works, even after millis rolls over. Don't attempt to reset millis.
if ( (millis () - motorOnTime) >= timeToRun)
// turn motor off
In this case you set up timeToRun to be the time you want it on (in milliseconds). If you do this in the main loop you are not "blocking" (with delay) and can thus do other things, like check other motors, switch presses, etc.