For example, the test for divisibility by $2$ is quite obvious. But I am quite intrigued by the others, particularly $3$, $7$ and $11$. Also I have come across tests for numbers as far as $50$. How do people even think of these? And consequently, how do they prove it?
2 Answers
There are various methods for developing divisibility criteria. Here is a fairly general one:
Let's develop a divisibility criterion for example with $13$. Take any integer $n$ with digits $a_k,a_{k-1},...,a_2,a_1,a_0$ and write its decimal expansion: $$n = (a_k \times 10^k) + (a_{k-1} \times 10^{k-1}) + .... + (a_2 \times 10^2) + (a_1 \times 10^1) + a_0$$ Notice the following congruences: $$10^0 \equiv 1 \ \ mod 13 \\ 10^1 \equiv 10 \ \ mod 13 \equiv (-3) \ \ mod 13 \\ 10^2 \equiv 9 \ \ mod 13 \equiv (-4) \ \ mod 13 \\ 10^3 \equiv 12 \ mod 13 \equiv (-1) \ \ mod 13 \\ 10^4 \equiv 3 \ \ mod 13 \\ 10^5 \equiv 4 \ \ mod 13 \\ 10^6 \equiv 1 \ \ mod 13 \\ \vdots $$ this means we get the $6$-step cycle: $$1,-3,-4,-1,\ 3,\ 4,\ 1,-3,...$$ thus: $${\small n\equiv\big(a_0+a_1\times(-3)+a_2\times (-4)+a_3\times(-1)+a_4\times 3+a_5 \times 4+a_6\times 1+a_7\times(-3)+...\big)\ \ mod 13}$$ Setting $${\small m = a_0 + a_1 \times (-3) + a_2 \times (-4) + a_3 \times (-1) + a_4 \times 3 + a_5 \times 4 + a_6 \times 1 + a_7 \times (-3) + ...}$$ it is clear that: $$n\equiv m \ \ mod 13$$ and that: $$m<n$$ and thus it is easier to check if $m$ is divisible by $13$. Notice that $$m\mid 13 \Leftrightarrow n\mid 13$$ Repeat as many times as necessary.
The above method works for any integer, however it is not the only applicable method. There other criteria as well (for any integer) that can be developed either through systematic or heuristic methods.

- 7,344
There's also the casting out rule. If $x$ is divisible by $n$ then $x - a*n*10^k$ is divisible by $n$. So one common trick is to multiply $n$ by something to get a number with last digit of 1 or maybe 9 and remove the last digit and cast acordingly.
Example: 23.
23*3 = 69. = 70 - 1. So $23|x \iff 23|(x + 70a - a)/10$.
So the rule is: take off the last digit. multiply it by 7. Add. repeat.
So for example: 23*1234 = 28382.
Take off the last digit. 2838. Multiply 2*7 = 14. Add 2838 + 14 = 2852. Repeat.
- 2*7 = 12. 285+14 = 299. 29. 9*7 = 63. 29+63 = 92. 9. 2*7 = 14. 9+14 = 23. It is divisible by 23.
Let's make one up for 37. 37*3 = 111. Oh! This is really good! If the last digit is a just subtract aaa and divide by 10.
Example: 8658. Subtract 888. 8658 - 888 = 777. Subtract 777. 777-777= 0. It's divisible by 37.
Let's make one for 43. 43*3 = 129 or 43*7 = 301. Truncate the last digit and subract 30 times it. Or truncate the last digit and add 13 times it.
43*9876 =424668
Truncate the 8: 42466. 8*30=240; subtract 240. 42226. Truncate the 6: 4222. 6*30 = 180; subtract 180. 4042. Truncate 2, subtract 60. 404 - 60 = 344. Truncate the 4: 34 and subtract 120: -86. Take absolute power. 86 subtract 43 and get 43. The test passes.
And so on.
=====
But to be honest, other than the 3, 9 and 11 test I hate these tests and prefer to cast directly.
Ex. Is 748354062 divisible by 57?
$748,354,062 - 570,000,000 \equiv 178,354,062 - 57,000,000 \equiv 131,354,062 - 57,000,000 \equiv 74,354,062 - 57,000,000 \equiv 17,354,062 -11,400,000 \equiv 5,954,062 - 5,700,000 \equiv 254,062 - 114,062 \equiv 140,062 - 114,000 \equiv 26,062 - 11,400 = 14,962 - 11,400 \equiv 3,562 - 570 \equiv 2,992 - 2,280 \equiv 712 - 570 \equiv 142 - 114 \equiv 28 \mod 57$.
So not only is it not divisible by 53, I know the remainder is 28. (I like to do this as I ride my bicycle and pass street addresses.)

- 124,253
$$2016 = 2x^3 + x + 6$$
So $2016$ is the value of that cubic polynomial at $x=10$. In the case of modulo $11$, we can replace $x=10$ with $x=-1$, which gives us the divisibility trick.
– Zubin Mukerjee Mar 06 '16 at 03:43