Consider the following problem:
Find all integer solutions to $y^2 = x^5 - 4$.
The solution goes something like – check modulo 11, where $x^5 \equiv 0, \pm 1$, and then check cases to arrive at the conclusion that no solution exists. I thought about checking mod 11 as from Fermat's little theorem we get $x^{10} \equiv 1 \pmod{11}$, but it was really a lucky guess.
My question is: how can one decide which moduli to check when one has to face a "polynomial" congruence?
Notice that by the Legendre symbol properties we have $$ \left(\frac{a}{p}\right) \equiv a^{\frac{p-1}{2}} \equiv x \pmod p $$ where $x$ can be only $-1$,$0$ or $1$. That's why if you have a $n$-th power in a diophantine equation and $2n+1$ is prime, then you're really lucky, although it is not a strange guess xd