One of the suggested proofs that I found to the $\int \csc(x) \, dx$ start with,
$$\int \csc(x) \, dx= \int \csc(x) \cdot \frac{\csc(x)- \cot(x)}{\csc(x)- \cot(x)} dx = \cdots$$
By graphing the function $f(x)=\csc(x)- \cot(x)$ I found that its have zeros for $x=2 \pi k$ for all $k \in \mathbb{Z}$.
So, I wonder if this proof it's valid for all $x \in \mathbb{R}$. Thanks for the clarification.
When you write $\int f(x)\,dx$ and expect to end up with something of the simple form $F(x)+C$, then you are only integrating $f$ over an interval on which $f$ is continuous. $\csc(x)$ has discontinuities at $k\pi$. So what has been done here is valid for say the interval $x\in(0,\pi)$.
The most general antiderivative for $\csc(x)$ would be $$-\ln\left|\csc(x)+\cot(x)\right|+C(x)$$ where $C$ is a function that is piecewise constant on intervals of the form $(k\pi,k\pi+\pi)$, and can take different values on different intervals.