\(\int\left(5+cot^2x\right)dx=\int\left(5+\dfrac{cos^2x}{sin^2x}\right)dx=\int\left(5+\dfrac{1-sin^2x}{sin^2x}\right)dx\)
\(=\int\left(4+\dfrac{1}{sin^2x}\right)dx=4x-cotx+C\)
\(\int\left(tan^2x+cot^2x\right)dx=\int\left(\dfrac{1-cos^2x}{cos^2x}+\dfrac{1-sin^2x}{sin^2x}\right)dx\)
\(=\int\left(-2+\dfrac{1}{cos^2x}+\dfrac{1}{sin^2x}\right)dx=-2x+tanx-cotx+C\)