I was confused by /Neodymion2's explanation until I realized that the multiplication relies on the C language (and I presume other's) ignoring overflow on unsigned multiplication. That is, everything to the left of the 'a' doesn't fit in a word, and in effect, is simply dropped. Right shifting gets rid of everything to the right of the 'a', so what you're left with is simply 'a'.
I proved it to myself using algebra, and to make it easy, tried it just on a 16 bit word-size, which means we multiply by 0x0101 = 2^8 + 1 (where '^' means 'to the power of'), and we shift by 8 to the right, and we have only two eight-bit counters, call them 'a' and 'b'. So the word we are counting is represented as an integer by 2^8*a + b, so multiplying we get:
(2^8*a + b) * (2^8 + 1) =
2^8*2^8*a + 2^8*a + 2^8*b + b =
2^16*a + 2^8*(a+b) + b
However 2^16*a doesn't fit in a 16-bit word so it gets dropped, so we are left with
2^8*(a+b) + b.
We then shift right by 8 bits, which gets rid of the lone 'b' and divides by 2^8, and that leaves the result as
a+b
Other places on the web say that some compilers will implement this multiply by shifting and adding, in which case it may be faster to not use the multiply, at least on 32-bit words.