I thought it was pretty straight forward but I'll see what I can do.

There are two global variables seconds which we will store our seconds in and lastTime which we will use to track how long it's been since we last calculated seconds.

In loop() countSeconds will be called every time. When countSeconds runs it puts the current millis in currentTime. Then we calculate elapsedTime which is currentTime - lastTime. So now we know how long it's been, in millis() since the last time countSecnds ran. The conditional, if, statment simply checks to see if elapsedTime is more than one second becuase if it isn't there is nothing to do and it returns 0 which gets added to seconds.

If elapsed time is longer than one second (1000 millis) then it has work to do.

First I record the new lastTime for our next calculation.

lastTime = currentTime - (elapsedTime % 1000);

Since we only account for full seconds we need to save any fractions of seconds to maintain some accuracy. So lastTime gets assigned the value of the currentTime less any fractions we didn't use. The % operator is modulo and returns the remainder from a divide operation. If elapsedTime was 1500, the remainder would be 500, by subtracting this from currentTime we don't lose that fraction of a second.

The next line simply returns elapsedTime / 1000 which will be all the seconds elapsedTime represents. If elapsedTime was 1500 the return value would be 1 and this gets added to seconds. The remaining 500 millis were accounted for in the previous line.

Hope that helps. You should be able to go through it line by line and see what's happening. You might look up the % (modulo) operator as well.