We have the identity
[tex](a + b)^2 = a^2 + 2ab + b^2 = a^2 + ab + b (a + b) \\\\ ~~~~ \implies a + b = \sqrt{a^2 + ab + b (a + b)} \\\\ ~~~~ \implies a + b = \sqrt{a^2 + ab + b \sqrt{a^2 + ab + b \sqrt{a^2 + ab + b \sqrt{\cdots}}}}[/tex]
assuming [tex]a+b\ge0[/tex].
For the numerator, let [tex]b=1[/tex], so [tex]a\ge-1[/tex], which means
[tex]a^2 + a = x \implies a = \dfrac{-1 + \sqrt{1 + 4x}}2[/tex]
and so
[tex]\sqrt{x + \sqrt{x + \sqrt{x + \sqrt{\cdots}}}} = \dfrac{-1 + \sqrt{1 + 4x}}2 + 1 = \dfrac{1 + \sqrt{1 + 4x}}2[/tex]
For the denominator, let [tex]b=-1[/tex] so that [tex]a\ge1[/tex]. Now
[tex]a^2 - a = x \implies a = \dfrac{1 + \sqrt{1 + 4x}}2[/tex]
so that
[tex]\sqrt{x - \sqrt{x - \sqrt{x - \sqrt{\cdots}}}} = \dfrac{1 + \sqrt{1 + 4x}}2 - 1 = \dfrac{-1 + \sqrt{1 + 4x}}2[/tex]
So, in the integral we can simplify and evaluate it to
[tex]\displaystyle \int_0^{2021} \frac{\sqrt{x + \sqrt{x + \sqrt{x + \sqrt{\cdots}}}}}{1 + \sqrt{x - \sqrt{x - \sqrt{x - \sqrt{\cdots}}}}} \, dx \\\\ ~~~~~~~~ = \int_0^{2021} \frac{\frac{1 + \sqrt{1 + 4x}}2}{1 - \frac{1 - \sqrt{1+4x}}2} \, dx \\\\ ~~~~~~~~ = \int_0^{2021} \frac{1 + \sqrt{1 + 4x}}{1 + \sqrt{1 + 4x}} \, dx \\\\ ~~~~~~~~ = \int_0^{2021} dx = \boxed{2021}[/tex]