Assuming standard operating procedure is that you have a main loop executing, and you want to perform some action periodically.
After you perform the action (straight away the first time through the loop), you save the current millis() and continue. Next time around the loop you read the value of millis() again and subtract the value obtained last time you performed the action. If the subtraction results in a number that is larger than your period then you perform the action again and get the new version of millis(), otherwise you don't.
Assume for the sake of this explanation that millis() is only an 8-bit number (the concept extends to 16- and 32-bit numbers equally well).
Also assume you want your periodic function to run every 30 ms, and that the loop takes 10 ms.
First time through the loop you perform your action and get the value of millis():
unsigned char last = millis()
Let's say last = 8. Next time around the loop millis() returns 18, so you do the subtraction:
00010010 (18: current)
-00001000 (8: last)
---------
00001010 (10)
this is repeated twice more until millis() returns 38 and then:
00100110 (38: current)
-00001000 (8: last)
---------
00011110 (30)
now we would perform the action and last would become 38.
Eventually (after the action had been performed 8 times) last would become 248, then the interesting bits start to happen, the next time through the loop, 10 ms have elapsed so millis() should be 258. 258 cannot be represented in 8 bits, so with rollover millis() would become 2. So now we to the subtraction:
00000010 (2: current)
-11111000 (248: last)
---------
00001010 (10)
The arithmetic unit "borrows" a bit (bit 9) and treats the minuend (the number being subtracted from) as if its value was 258 (0x102, 100000001 binary). In other words, inside the CPU the calculation actually looks like this:
100000010 (258: current)
-011111000 (248: last)
---------
000001010 (10)
Twice more around the loop and you get this:
00010110 (22: current)
-11111000 (248: last)
---------
00011110 (30)
Then you perform your action, set last to 22 and off you go.