Let $L_i$ be the iid RV representing the cost of the $i$th failure. Let $N$ be the RV number of losses before winning, so $N\sim\text{Geom}(p)$, which is a stopping time for our process. Then, the total expected loss is: $$ \mathbb{E}\left[\sum_{i=1}^N L_i\right] = \mathbb{E}[N]\mathbb{E}[L_i] $$ by Wald's identity.
For example, if you lose $L_i=100$ each time (i.e. $L_i$ is not random) with success probability $p=0.2$, we have $\mathbb{E}[N]=1/p=5$ so total loss is $500$.
Now suppose there is a consolation prize worth $30$, but no monetary award for winning. So, if you lose $L_i=70$ each time you dont get the prize, and there is success probability $p=0.2$, we get: $$ \text{Expected Cost} = \mathbb{E}[N]\mathbb{E}[L_i] = \frac{1}{p}[(100p)+70(1-p)] = 5[0.2(100)+0.8(70)]=380 $$ Basically this means you can expect 4 losses (losing $70$ each) and 1 win (costing $100$).