Given:
#f(x)=(e^x+sinx)(cot^2x+1)#
Let
#y=f(x)#
#u=(e^x+sinx)#
#v=(cot^2x+1)#
By the product rule,
#d/(dx)(uv)=u(dv)/(dx)+v(du)/(dx)#
Here,
#u=(e^x+sinx)#
Differentiating wrt x
#(du)/(dx)=d/(dx)(u)#
#d/(dx)(u)=d/(dx)(e^x+sinx)#
By the sum rule
#d/(dx)(e^x+sinx)=d/(dx)(e^x)+d/(dx)(sinx)#
#d/(dx)(e^x)=e^x#
#d/(dx)(esinx)=cosx#
#d/(dx)(e^x+sinx)=e^x+cosx#
#d/(dx)(u)=e^x+cosx#
#(du)/(dx)=e^x+cosx#
#v=(cot^2x+1)#
Differentiating wrt x
#(dv)/(dx)=d/(dx)(v)#
#d/(dx)(v)=d/(dx)(cot^2x+1)#
By the sum rule
#d/(dx)(cot^2x+1)=d/(dx)(cot^2x)+d/(dx)(1)#
#d/(dx)(cot^2x)=2cotx(-csc^2x)#
#d/(dx)(cot^2x)=-2cotxcsc^2x#
#d/(dx)(1)=0#
#d/(dx)(cot^2x+1)=-2cotxcsc^2x+0#
#d/(dx)(v)=-2cotxcsc^2x#
#(dv)/(dx)=-2cotxcsc^2x#
#d/(dx)(uv)=u(dv)/(dx)+v(du)/(dx)#
#u=(e^x+sinx)#
#v=(cot^2x+1)#
#(du)/(dx)=e^x+cosx#
#(dv)/(dx)=-2cotxcsc^2x#
#d/(dx)((e^x+sinx)(cot^2x+1))=(e^x+sinx)(-2cotxcsc^2x)+(cot^2x+1)(e^x+cosx)#