A number is divisible by 8 if the last three digits are divisible by 8. For instance, the number 1192 is divisible by 8 because its last three digits, in other words 192, are divisible by 8.
Using modular arithmetic, consider that any positive integer N can be written as 1000*M + 100*a + 10*b + 1*c where M is a non-negative integer. The first three digits of N are represented by a, b and c. Because 1000 is divisible by 8, any multiple of M is also divisible by 8. However, because 100, 10 and 1 are not divisible by 8, these three numbers must be tested for divisibility by 8.