The accepted answer, to use the Kelly criterion, is at best incomplete, if not misleading. It is not what professionals do in practice. It's great to bring up the Kelly criterion, but I think it doesn't actually answer the question.
The "best way" to gamble with an advantage depends on your goals. The Kelly criterion ($f^* = (bp-q)/b = 1/2$ here) is optimal if your goal is to maximize the expected logarithm of your bankroll. It also maximizes the median bankroll among proportional betting systems in an asymptotic sense which fails for finite $n$.
The Kelly criterion is not normally used by professionals who have an advantage, such as professional poker players or hedge fund managers. There are many reasons for this. The main reason is that people are usually more risk-averse than is described by a logarithmic utility function. People often use a fractional Kelly system, which recommends betting a fixed fraction of the amount recommended by the Kelly criterion. Some hedge funds use a fraction of $1/6$. Many professional gamblers view $1/4$ as conservative, and $1/2$ as aggressive. Warren Buffett (known for being aggressive) is said to use a Kelly fraction closer to $0.7$. All of these are significantly more conservative than the Kelly criterion itself, which corresponds to a Kelly fraction of $1$. One consequence of using a Kelly fraction $k$ in a continuous version is that the probability that your bankroll ever falls to $\alpha$ times the original bankroll is $\alpha^{\frac{2}{k} - 1}$. For example, this is $\alpha$ for the Kelly criterion itself, and $\alpha^3$ for a Kelly fraction of $1/2$.
Be careful that the money in your pocket is not usually your bankroll. Fractional Kelly systems assume that losing your bankroll is an infinitely bad disaster. Losing the money in your pocket is probably just an inconvenience. So, you often want to bet a larger fraction of the money in your pocket than your preferred Kelly fraction might suggest. See the bankroll management chapter of my book, The Math of Hold'em.
Back to the second question: "How could we maximize our chance of winning?" It depends what you mean by winning, but it is hard to find a definition so that the Kelly criterion is the answer. Let's suppose $n=10$, and of course that you only bet on heads.
If by winning, you mean you would like to come out ahead, the Kelly criterion comes out ahead if you win at least $7$ times out of $10$. Winning only $6$ times multiplies your bankroll by $3^6/2^{10} = 0.71$. Winning $7$ times multiplies it by $3^7/2^{10} = 2.14$. The chance that the favorable coin will have at least $7$ heads out of $10$ is $77.6\%$.
If you bet up to about $38.9\%$ of your bankroll at each step, then you will come out ahead if there are at least $6$ heads out of $10$, which happens $92.2\%$ of the time. By the way, anything close to the Kelly fraction achieves an expected growth rate which is almost as large. Betting $35\%$ of your bankroll at each step has a greater chance to finish ahead than the Kelly criterion while only giving up about $10\%$ of the growth rate.
You can't come out ahead after $5$ heads and $5$ tails if you are betting the same fraction of your bankroll each time since $(1-x)(1+x) = 1-x^2 \lt 1$. However, if you start by making a small bet, and increase the size of your bets when you lose by just enough to come out ahead, and bet nothing after winning, then you have constructed a reverse lottery ticket. You can have a $99.9999\%$ chance to win at least once and gain $\$0.01$, and about a $1/$million chance that you lose all $10$ times and are out $\$10.23$.
How should you gamble if you would like to maximize your chance to win $\$100$ within $10$ tosses, and you don't have $\$102,300$ in your pocket to cover the reverse lottery ticket? The classic monograph How to gamble if you must: Inequalities for stochastic processes and many more recent works cover the case where you have to bet on the losing side. (Bold play is optimal but it is not uniquely optimal.) However, one speaker at a conference on financial mathematics claimed that how to bet on the winning side is an open problem.