This is a problem from Feller's Introduction to probability theory and its aplications, Vol 1. The complete statement of the problem goes like:
Let $a$ and $b$ be positive, and $-b < c < a$. The number of paths to the point $(n,c)$ wich meet neither the line $x = -b$ nor $x = a$ is given by the series: $$\tag1 \sum_{k={-\infty}}^{\infty} (N_{n,4k(a+b)+c}-N_{n,4k(a+b)+2a-c})$$
Where $N_{n,c}$ is the number of paths from the origin to the point $(n,c)$. The only hint of the problem is to use repeated reflection but i don't get how to do that. I sincerely don't have much of a clue of how to do this problem, any help would be apreciated.
I gave a sketch of a proof in the special case $a=b$ in this answer. It is an inclusion-exclusion type argument; take all $N(n,c)$ paths, then subtract the "bad" paths which cross either $x=a$ or $x=-b$. But you must then add back in the doubly subtracted paths which cross both lines, which can be done by applying the reflection principle twice. However, there are still triple crossing to account for, etc, etc.
Here is a second argument which is more direct.
If you repeatedly reflect the point $(n,c)$ across the lines $x=a$ and $x=-b$, then the points you reach are of the form $$ (n,2k(a+b)+c)\qquad \text{and}\qquad (n,2k(a+b)+2a-c) $$ Note the difference between this and the problem statement; Feller is in error.
Let the points in the first form be colored blue, and the second category be colored red. If you reflect a red point though either $x=a$ or $x=-b$, you get a blue point, and vice versa.
For any point $(t,x)$, let $N^*(t,x)$ be the set of "bad" paths to $(t,x)$ which cross either the line $x=a$ or $x=-b$ at some point. The quantity you are trying to calculate is $$N(n,c)-N^*(n,c),\tag1$$ so you just need to find $N^*(n,c)$. This is done with the following lemma:
Proof: The left hand side counts the set of bad paths to any blue point, while the RHS counts bad paths to any red point. A bijection from the LHS to the RHS is given by taking a bad path to a blue point, and reflecting everything after the first point it hits either of the lines $x=a$ or $x=-b$. $\square$
The proof is completed by solving $(2)$ for $N^*(n,c)$, substituting that expression into $(1)$, and noting that $N^*(n,c')=N(n,c')$ for any red or blue point $(n,c')$ (except when $c=c'$).