Consider the random walk on $\mathbb{Z}$, where the probability of going one step to the right from any given state shall be $p\in (0,1)$. Starting in 0, what is the probability of returning to 0 in $n$ steps?
First of all, I denote this probability by $p_{00}^{(n)}$. Then if $n$ is odd, then the probability is 0, right?
Then I tried to do it for n=2 and n=4.
n=2:
$$ p_{00}^{(2)}=p_{01}^{(1)}(1-p)+p_{0-1}^{(1)}p=p_{01}(1-p)+p_{0-1}p=p(1-p)+(1-p)p=2(1-p)p $$
n=4: $$ p_{00}^{(4)}=p_{01}^{(3)}(1-p)+p_{0-1}^{(3)}p=...=6p^2(1-p)^2 $$
Is that right?
But how can I get the result for any even number?
Let us take $n$ even.
You have to have as many left moves than right moves.
The probability of getting, for example, the first $n/2$ left then the next $n/2$ right is $$ p^{n/2}(1-p)^{n/2} $$
But there are other possibilities: there are $n$ moves, $n/2$ of which must be left. Hence you must multiply the base probability by $ \binom n{n/2} $.
The probability is eventually $$\binom n{n/2}p^{n/2}(1-p)^{n/2} $$
check: with $n=4$ we have $\binom n{n/2} = \frac{4\times 3}{2\times 1} = 6$ so it is coherent with your computation.