∫ 1/(1 + tanx) dx
= ∫ 1/(1 + sinx/cosx) dx
= ∫ cosx/(cosx + sinx) dx
= (1/2)∫ [(cosx + sinx) + (cosx - sinx)]/(cosx + sinx) dx
= (1/2)∫ dx + (1/2)∫ (cosx - sinx)/(cosx + sinx) dx
= (1/2)∫ dx + (1/2)∫ d(sinx + cosx)/(cosx + sinx) dx
= (1/2)[x + ln|sinx + cosx|] + C