The remainder of division can* be computed by repeatedly removing the divisor until the number to be divided is less than the divisor. For a binary number and a power of two divisor this subtraction only affects the bits on the left, making them 0, but keeps the bits to the right unchanged.
1110001111100001₂ 58337
- 0000000100000000₂ 2⁸
= 1110001011100001₂ 58081
___________________________
1110001011100001₂ 58081
- 0000000100000000₂ 2⁸
- 0000000100000000₂ 2⁸
...
= 0000000011100001₂ 57569
When the divisor is uneven all the lower bits can be affected when repeatedly removing it:
1110001111100001₂ 58337
- 0000000011000011₂ 195
= 1110001100011110₂ 58142
___________________________
1110001111100001₂ 58337
- 0000000011000011₂ 195
- 0000000011000011₂ 195
...
= 0000000000100000₂ 32
Note that it is sufficient for the divisor to not be divisible by two, because each factor of two shifts a number one digit to the left in binary and a subtraction can on only change digits to the left, never to the right.
The further away the divisor is from a power of two, that is the more the digits are equally 0 and 1 the more digits of the remainder are going to be affected with each subtraction. This means for example that the modulus 78985 (10011010010001001₂) is much better than 65537 (10000000000000001₂) even though it is not prime, whereas 65537 is.
This all applies where the hash is "poor", that is not equally distributed in all output bits. If we had a good hash, we can use all hash table sizes and therefore divisors we want to and any methods of range reduction like fastrange.
*It is typically not actually computed like this, but the result is equivalent