In the given case, since the given polynomial is of the fifth degree, you only have to try S=1,2,3,4 and up to 5.
Let's factor the polynomial
From this you will find the factors have the following properties:
n=0 (mod 4)
n=0 (mod 4) ... hypothesis
n-4=0 (mod 4)
n-1=3 (mod 4)
n+1=1 (mod 4)
n+2=2 (mod 4) since n=0 (mod 4)
Which means that if S=4, then
f(n) = 0 for all n≥4 since the factors have residues 0,1,2,3 when divided by 4.