Help with finding tangent to curve at a point 
Find an equation for the tangent to the curve at $P\left( \dfrac{\pi}{2},3 \right )$ and the horizontal tangent to the curve at $Q.$ 
  $$y=5+\cot x-2\csc x$$

$y\prime=-\csc ^2 x -2(-\csc x \cot x)$
$y\prime= 2\csc x \cot x - \csc ^2 x\implies$ This is the equation of the slope.  
Now I find the slope at $x=\dfrac{\pi}{2}:$
$$y^{\prime}=2\csc \left( \frac{\pi}{2} \right) \cot \left( \frac{\pi}{2} \right)- \csc ^2 \left( \frac{\pi}{2} \right)$$ $$y^{\prime}= -1$$ 
Equation for the tangent to the curve at $P$:
$$y-3=-1\left( x-\frac{\pi}{2} \right)$$ $$y=-x+\frac{6+\pi}{2}$$ 
Then I found the horizontal tangent at $Q$, which is where the slope is $0.$ So I set the slope equation equal to $0:$ 
$$y^{\prime}= 2\csc x \cot x - \csc ^2 x=0$$ $$-\csc ^2 x = -2\csc x \cot x$$ 
$$-\frac{1}{\sin^2 x}=-2\left( \frac{1}{\sin x} \frac{\cos x}{\sin x} \right )$$ 
$$\cos x = \frac{1}{2}$$

I don't know how to proceed from here. Since $\cos x = \dfrac{1}{2}$, $\cos^{-1}\left (\dfrac{1}{2}\right)=\dfrac{\pi}{3}$.
Plugging this into the equation would give the $y$ value, and I'd be able to find the equation of the tangent line, but I'm confused because there is not just one $x$ to consider, since $x=2n \pm \dfrac{\pi}{3}$. 
The answer for equation of tangent at $Q$ is $y=5-\sqrt{3}$, and I don't know how to get this. 
Can you please show how to work this last part in details? Thank you. 

This means that there can be infinitely many horizontal tangents. As simple as that .
Just pick up the one you want.
$x = 2n \pm \dfrac{\pi}3$ is one solution.
Corresponding $y$ value

$y = 5 + \cot\left(2n \pm \dfrac{\pi}3\right) -2\csc\left(2n \pm \dfrac{\pi}3\right)$
$y = 5 \pm \dfrac1{\sqrt3} \pm \dfrac4{\sqrt3} $
$y = 5 \pm \sqrt3$

So one solution is $ y = 5 - \sqrt3$
It's better you solve $x = 2n + \dfrac{\pi}3$ and $x = 2n - \dfrac{\pi}3$ separately so as to not get yourself confused.
