I am looking for a solution based on martingales. I only saw solutions based on MC with barriers and Gambler's ruin with $p=0.5$
A symmetric random walk, i.e. with equal probability one makes a unit step left and right, respectively. Given positive integers $x,y$ we position walker at place $x.$ What is the probability to reach $x+y$ before we reach 0?
Let $p$ be the probability of reaching $x+y$ (rather than reaching $0$). So the probability of reaching $0$ is $1-p$ (note that the probability of never reaching either end is $0$).
Let $Z$ be the position at the end of the walk. We have $E[Z]=p\cdot (x+y)+(1-p)\cdot 0 = p\cdot (x+y)$.
But also, since it is a symmetric random walk, at each step, the expected displacement is $0$ (that is $\frac12 \cdot 1 + \frac12 \cdot(-1)$). So the walker's expected ending position is $E[Z]=x$, the starting position.
Equating these two expression for $E[Z]$, we get $p\cdot (x+y)=x$. So $p=\frac{x}{x+y}$.