Rearrange: int cos(x)/[2-cos(x)] dx = int {2/[2 - cos(x)]} - 1 dx
Let t = tan (x/2) --> cos(x) = (1 - t^2)/(1 + t^2)
Now, dt/dx = (1/2)*sec^2(x/2) = (1/2)*(1 + t^2) [using Pythagorean identity tan^2(a) + 1 = sec^2(a)]
So, dx = (2 dt)/(1 + t^2)
Now you can rewrite the integral (this is going to get confusing) as:
int {2/[2- (1 - t^2)/(1 + t^2)] - 1} * [2dt/(1 + t^2)]
= int 2/[2(1 + t^2) - (1 - t^2)] - 2/(1 + t^2) dt
= int 2/(1 + 3t^2) - 2/(1 + t^2), which will work out to be inverse tans.
To avoid further confusion for myself and everyone else, I'll leave the rest for you to do. Don't forget to sub back t = tan(x/2) in the end.