We make the substitution,
$$\tan\left(\frac{x}{2}\right)=t$$ $$I(a,b)=\int \frac{1}{a+b(\cos x)} \,\mathrm dx$$
$$I(a,b)=2\int \frac{1}{(a+b)+t^2(a-b)} \,\mathrm dt$$
$$I(a,b)=\frac{2}{(a-b)} \int \frac{1}{\left(\sqrt{\frac{a+b}{a-b}}\right)^2+t^2}\,\mathrm dt$$
Hint : $\displaystyle \int \frac{1}{a^2+t^2}\,\mathrm dt=\frac{1}{a} \tan^{-1}\left(\frac{t}{a}\right)+c.$
$$I(a,b)=\frac{2}{\sqrt{{(a+b)}{(a-b)}}} \tan^{-1}\left(\frac{t}{\sqrt{\frac{a+b}{a-b}}}\right)+c$$
$$\boxed{I(a,b)=\frac{2}{\sqrt{{(a+b)}{(a-b)}}} \tan^{-1}\left(\frac{\tan\left(\frac{x}{2}\right)}{\sqrt{\frac{a+b}{a-b}}}\right)+c}$$
Now the original integral;
$$I=\int_0^y \frac{1}{\cos y + \cos x} \mathrm dx$$
Set $a = \cos y$ and $b = 1$,
$$\boxed{I(\cos(y),1)=\frac{2}{\sqrt{{(1+\cos y)}{(\cos y-1)}}} \tan^{-1}\left(\frac{\tan\left(\frac{x}{2}\right)}{\sqrt{\frac{1+\cos y}{\cos y-1}}}\right)+c}$$
Note $\cos y$ is a constant and not another variable to worry about.
Applying bounds $[0,y]$,
$$\boxed{I(\cos(y),1)=\frac{2}{\sqrt{{(1+\cos y)}{(\cos y-1)}}} \tan^{-1}\,\left(\frac{\tan\left(\frac{y}{2}\right)}{\sqrt{\frac{1+\cos y}{\cos y-1}}}\right)}$$
Alternate closed form :
$$\boxed{I(\cos(y),1)=\frac{2\mathrm{i}\mathrm{e}^{\mathrm{i}y} \left(\ln\left(\left|\mathrm{e}^{\mathrm{i}y - \mathrm{i}x} + 1\right|\right) - \ln\left(\left|\mathrm{e}^{-\mathrm{i}x} + \mathrm{e}^{\mathrm{i}y}\right|\right)\right)}{\mathrm{e}^{2\mathrm{i}y} - 1}+c}$$
Applying bounds $[0,y]$,
$$\boxed{I(\cos(y),1)=\csc(y)\ln|\sec(y)|}$$
If you are confused, do refer this for clear understanding of $\cos y$ is just a distraction
Note : Usage of these two have been made; $\cos x = \dfrac{e^{ix}+e^{-ix}}{2}$ and see this
Otherwise, some people may ask for it to close without you receiving your reply.
– algevristis Jun 10 '22 at 18:45