Say the gambler currently has fortune $a$, then if he wins, he will earn $a(2p-1)$ and his fortune will become $a + a(2p-1) = 2pa$. If he loses, he will lose $a(2p-1)$ and his fortune will become $a-a(2p-1) = (2-2p)a$.
And we know that all the winning/losing events in the sequence are independent, so the joint probability can be calculated with simple multiplication.
Let's say, out of the $n$ gambles, he wins $i$ times and loses $(n-i)$ times, then after the $i$ wins and $(n-i)$ loss, his fortune will be $$ a \cdot (2p)^i \cdot (2-2p)^{n-i}$$
Then let's look at the wins and losses of the $n$ gambles. The probability of winning $i$ times (and clearly losing $n-i$ times) is equal to $$ \binom{n}{i} p^{i}(1-p)^{n-i} $$ because there are $\binom{n}{i}$ ways of winning exactly $i$ times (and losing exactly $(n-i)$ times).
Thus the expectation after $n$ gambles would be $$ \sum_{i = 0}^{n}\binom{n}{i}p^i(1-p)^{n-i}a(2p)^{i}(2-2p)^{n-i} $$