This is a generic approach (find a transformation that make the utility problem easier to work with.
Assume a household has utility $$U(x,y) = x^\alpha y^\beta$$.
A utility function is a convenient way to represent preferences.
However, we saw in the chapter that utility functions have many
limitations. One limitation is that although utility functions tell us
a lot about the ordinal rankings of goods, they reveal nothing about
cardinal rankings. In other words, we know what a consumer prefers,
but not the strength of that preference. Because of this, we can
shift, stretch, or squeeze the utility function into any form as long
as we don’t change the ordering of preferences over bundles, and we’ll
still have the same representation of the relative utility of goods.
Microeconomics by by Austan Goolsbee, Steven Levitt, and Chad Syverson
We'll take the log of this utility function because it is a positive monotonic transformation. It will give all the same preference relationships, so we can calculate the same demand functions.
$$u(x,y) = \log (U(x,y)) = \alpha \log (x) + \beta \log(y) $$.
Let's rewrite to optimization function
$$ \max_{s.t. x p_x + y p_y = m} \alpha \log (x) + \beta \log(y) $$
Which I find easier to understand as a Lagrangian.
$$ \max \alpha \log (x) + \beta \log(y) - \lambda (x p_x + y p_y - m) $$
$$ \frac{\partial u}{\partial x} = \frac{\alpha}{x} -\lambda p_x = 0$$
$$ \frac{\partial u}{\partial y} = \frac{\beta}{y} -\lambda p_y = 0$$
$ \Rightarrow \frac{\alpha}{x p_x} = \lambda $ and $ \frac{\beta}{y p_y} = \lambda $
$ \Rightarrow \frac{\alpha}{x p_x} = \frac{\beta}{y p_y}$ $ \Rightarrow y = \frac{\beta x p_x}{\alpha p_y}$
Then use the budget equation:
$$m = x p_x + y p_y = x p_x + \frac{\beta x p_x}{\alpha p_y} p_y$$
$$ \Rightarrow m = x p_x + \frac{\beta x p_x}{\alpha} = x p_x(1 + \frac{1}{\alpha})$$
$$ \Rightarrow x^* = \frac{m}{p_x(1 + \frac{1}{\alpha})}$$
$$ \Rightarrow y^* = \frac{\beta x^* p_x}{\alpha p_y} = \frac{\beta \frac{m}{p_x(1 + \frac{1}{\alpha})} p_x}{\alpha p_y} = \frac{\beta \frac{m}{(\alpha + 1)} }{ p_y} $$
Note that $ \frac{x p_x}{m}$ is constant and function of the household's preferences but not the relative prices. This is the famous constant budget share result of Cobb Douglas preferences.
There is another approach which is Cobb-Douglas specific.
Note that if the utility function is $U(x,y) = x^\alpha y^\beta$ then the marginal utility functions are:
$$ U_x = \alpha x^{\alpha-1} y ^{\beta} = \alpha \frac{U}{x}$$
$$ U_y = \alpha x^{\alpha} y ^{\beta - 1} = \beta\frac{U}{y}$$
Which means the first order condition with the Lagrangian is
$$ \frac{\partial U}{\partial x} = \alpha \frac{U}{x}$ -\lambda p_x = 0$$
$$ \frac{\partial U}{\partial y} = \beta\frac{U}{y} -\lambda p_y = 0$$
Which implies:
$$\beta\frac{U}{y p_y} = \alpha \frac{U}{x p_x} \Rightarrow \beta\frac{x p_x}{\alpha p_y} = y$$
Which is exactly what we got doing it the first way and will give the same $x^*$ and $y^*$.