Could I use the integration by Weierstrass substitution or tangent-half angle substitution for this case? Because I see on Wikipedia, when the lower limit was $0$, they made the definite integral split into two things, where the first integral is from $0$ to $\pi$ and the second one is $\pi$ to $2 \pi$. Because the article said that "In the first line, one cannot simply substitute $t=0$ for both limits of integration." This is what the article work like this
Blockquote $$\begin{align} \int_0^{2\pi}\frac{dx}{2+\cos x} &= \int_0^\pi \frac{dx}{2+\cos x} + \int_\pi^{2\pi} \frac{dx}{2+\cos x} \\[6pt] &=\int_0^\infty \frac{2\,dt}{3 + t^2} + \int_{-\infty}^0 \frac{2\,dt}{3 + t^2} & t &= \tan\tfrac x2 \\[6pt] &=\int_{-\infty}^\infty \frac{2\,dt}{3+t^2} \\[6pt] &=\frac{2}{\sqrt 3}\int_{-\infty}^\infty \frac{du}{1+u^2} & t &= u\sqrt 3 \\[6pt] &=\frac{2\pi}{\sqrt 3}. \end{align}$$ In the first line, one cannot simply substitute ${\textstyle t=0}$ for both limits of integration. The singularity (in this case, a vertical asymptote) of ${\textstyle t=\tan {\tfrac {x}{2}}}$ at ${\textstyle x=\pi }$ must be taken into account. Alternatively, first evaluate the indefinite integral, then apply the boundary values. $${\displaystyle {\begin{aligned}\int {\frac {dx}{2+\cos x}}&=\int {\frac {1}{2+{\frac {1-t^{2}}{1+t^{2}}}}}{\frac {2\,dt}{t^{2}+1}}&&t=\tan {\tfrac {x}{2}}\\[6pt]&=\int {\frac {2\,dt}{2(t^{2}+1)+(1-t^{2})}}=\int {\frac {2\,dt}{t^{2}+3}}\\[6pt]&={\frac {2}{3}}\int {\frac {dt}{{\bigl (}t{\big /}{\sqrt {3}}{\bigr )}^{2}+1}}&&u=t{\big /}{\sqrt {3}}\\[6pt]&={\frac {2}{\sqrt {3}}}\int {\frac {du}{u^{2}+1}}&&\tan \theta =u\\[6pt]&={\frac {2}{\sqrt {3}}}\int \cos ^{2}\theta \sec ^{2}\theta \,d\theta ={\frac {2}{\sqrt {3}}}\int d\theta \\[6pt]&={\frac {2}{\sqrt {3}}}\theta +C={\frac {2}{\sqrt {3}}}\arctan \left({\frac {t}{\sqrt {3}}}\right)+C\\[6pt]&={\frac {2}{\sqrt {3}}}\arctan \left({\frac {\tan {\tfrac {x}{2}}}{\sqrt {3}}}\right)+C.\end{aligned}}} $$ By symmetry, $$\begin{align} \int_{0}^{2\pi} \frac{dx}{2 + \cos x} &= 2 \int_{0}^{\pi} \frac{dx}{2 + \cos x} = \lim_{b \rightarrow \pi} \frac{4}{\sqrt3} \arctan \left( \frac{\tan\tfrac x2}{\sqrt3}\right) \Biggl|_{0}^{b}\\[6pt] &= \frac{4}{\sqrt3} \Biggl[ \lim_{b \rightarrow \pi} \arctan \left(\frac{\tan\tfrac b2}{\sqrt3}\right) - \arctan (0) \Biggl] = \frac{4}{\sqrt 3} \left( \frac{\pi}{2} - 0\right) = \frac{2\pi}{\sqrt 3}, \end{align}$$ From: https://en.wikipedia.org/wiki/Tangent_half-angle_substitution