Let's consider a random walk.
We start on the tile $n_0$.
For our $q$th step, if we're already on the tile $k$ then we have a probability $P_{q,k,p}$ to go to the tile $p$ with $p\in\mathbb{N}$.
The first action (moving from tile $n_0$ to another tile/staying on tile $n_0$) is the step number $1$.
The tile $0$ is the exit: if we reach it, the walk ends.
Let $n,m\in\Bbb{N}$, what is the probability to have stepped on the tile $n$ exactly $m$ times when our walk has ended ?
Edit: let's consider a simpler case than the one above
For any step, we have a probability $P_{k,p}$ to move from tile $k$ to tile $p$ where $p\in\{k-1,k,k+1\}$ (we can move by one tile at most)