Sample sizes for two independent samples w dichotomous outcomes I have two groups of very unevenly distributed data, one group has 95% more observations than the other group. My outcome variable is a binary variable.
I know how to calculate the effect size, but I'm curious how to go from there to finding out the sample size for a certain power and significance. I know the formulas, I just don't have an understanding of why.
$Cohen's \ d$ = $ES$ = $\frac{\mu_1 - \mu_2}{s_p}$ (see here),
and the formula for determining the sample sizes to ensure that the test has a specified power is given below (see here)
$n_i$ = $2*(\frac{Z_{1-\alpha/2}+Z_{1-\beta}}{ES})^2$
Can anybody explain the idea/motivation behind this last formula?

To complement the existing answer with a more visual/intuitive aspect of the sample size formula you mentioned. As you might have read from the Wikipedia page that these formulas actually origin from the type of test to want to perform.
Here you can find a simple/intuitive explanation of the numerator (where power is involved: Power Analysis Made Easy. I reproduced the same diagram keeping the Z value for ease of understanding:

Of course, the (pooled) standard deviation does not appear in the equation because it is hidden within ES, the effect size.
Finally, to complete the intuitive aspect of this answer, here is a nice tool that allows you to play with the different parameters involved in the formula: https://rpsychologist.com/d3/nhst/
