How does changing the allocation ratio affect the required sample size in a medical trial? When finding the sample size for a medical trial with a $1:1$ allocation ratio between treatment and placebo groups where the standard deviation is 10, $\tau = 5$, with a significance level of $5\%$ and a power of $80\%$, the calculation goes (I believe) as follows:
Given $\alpha = 0.05$, $\beta = 0.2$, $\tau = 5$, and $\sigma = 10$.
Where $n$ is the sample size
$$
n=2(z_{\alpha/2}+z_\beta)^2\ast\sigma^2/\tau^2\
$$
$$
n=2(z_{0.025}+z_{0.2})^2\ast10^2/5^2\ 
$$
$$
n=2(1.96+0.85)^2\ast4=63.2
$$
Therefore the required sample size for a 1:1 ratio would be 64 patients.
How does this calculation change with a 2:1 ratio or 3:1 ratio where the larger group is the placebo?
 A: First, your sample size computation for a two-sample z test comparing two unknown population means, variances known. is correct. The sample size $n = 64$ is for each group, so
you would need $2n = 128$ subjects total for the
scenario you computed.
If you want an unbalanced z test, you need to go back to the derivation of the formula you used in your question and set $n_2 = 2n_1$ from the start. You will find that unbalanced designs are less
efficient than balanced ones, so you will need more than
$n_1 = 43, n_2 = 86, n_1 + n_2 = 129$ subjects to get the same power.
A similar computation for finding the sample size for given
effect $\tau,$ standard deviations $\sigma = \sigma_1=\sigma_2$ and power for a pooled t test requires use of noncentral t distributions. You can find a derivation and explanation in intermediate level
applied statistics and mathematical statistics texts, or online.
Many statistical software programs have 'power and sample size' procedures. Also, there are online 'power and sample size' calculators (of varying degrees of clarity and accuracy). Most software procedures treat only the balanced case with $n_1 = n_2$ and so will not help you with your current Question.
However, it is easy to find the power for various scenarios
by simulation. I will start with a simulation for a pooled t test (variances unknown but equal) similar to the computation you show in your question (except for a t test). For sample sizes as large as here.
there is not much difference between the power of a t test
and the power of a z test, so the result is to use $n_1 = n_2 = 64.$ as in your computation, to get power 80%.

Notes on R code: With 100,000 iterations power
probabilities should be accurate to two places. At the end
of the run, the vector pv has 100,000 P-values of t tests.
The logical vector pv <= 0.05 has 100,000 TRUEs and FALSEs. The mean of a logical vector is the proportion
of its TRUEs.

set.seed(2021)
n = 64;  sg = 10;  t = 5
pv = replicate(10^5, t.test(rnorm(n,0,sg), 
                            rnorm(n,t,sg), var.eq=T)$p.val)
mean(pv <= 0.05)  # power
[1] 0.79896

It takes a little trial and error to get sample sizes in the
ratio 1:2 or 1:3 that will give 80% power. During trial and
error one can speed up the simulations without catastrophic
loss of accuracy by using 10,000 iterations instead of 100,000.
Here are some good approximations to unbalanced sample
sizes that give close to 80% power. For a 2:1 ratio, you need a total of $100 + 50 = 150$ subjects and for a 3:1 ratio,
you need a total of $126 + 42 = 168$ subjects.
# 2:1 ratio
set.seed(605)
n1 = 100;  n2 = 50;  sg = 10;  t = 5
pv = replicate(10^5, t.test(rnorm(n1,0,sg),
                            rnorm(n2,5,sg), var.eq=T)$p.val )
mean(pv <= .05)
[1] 0.81801

# 3:1
set.seed(621)
n1 = 126;  n2 = 42; t = 5;  sg = 10
pv = replicate(10^5, t.test(rnorm(n1,0,sg),
                             rnorm(n2,t,sg), var.eq=T)$p.val)
mean(pv <= .05)
[1] 0.79586

