For what values of $n$ , does $7 \mid 5^n+1$ $7 \mid 5^n+1$ implies $5^n+1=7a$ for some integer $a$
i.e $5^n=7a-1$
Now , $5^n$ is an integer which always ends with $5$ [for any integer $n$].
Thus , $7a-1$ must also end with $5$.But , this is only possible when , $a$ is an integer ending with $8$ as, $7 \times 8=56$  and $6-1=5$.
But , for all digits ending with $8$ say $8$ itself , $5^n$ does not exist.
So , how to solve this sum ? Please help me .
Thank you.

$5^n\equiv 1,5,4,-1,2,3,1\pmod{\! 7}$ for $n=0,1,2,3,4,5,6$, respectively.
This pattern continues and $\, 5^n\equiv -1\iff n\equiv 3\, $ mod $6$.    
More rigorously: $3$ is the least nonnegative $c$ giving $5^c\equiv -1\pmod{\! 7}$.    
Let $n=3+k$ with $k\ge 0$. We'll show $5^n\equiv -1\pmod{\! 7}$ iff $k=6m$ for some $m\ge 0$.
$5^{n}\equiv 5^{3+k}\equiv -5^{k}\equiv -1\pmod{\! 7}\iff 5^k\equiv 1\pmod{\! 7}$. 
This is true iff $k=(\text{ord}_7 5)m=6m$ for some $m\ge 0$.
