I need to find the principal part of the holomorphic functions: $$ \frac{1}{1-\cos z},\,\,\text{in $z_0=0$, and}\,\, \tan z\,\,\text{in $z=\pi/2$} $$ So using the Taylor series of $\sin z$ and $\cos z$ yields: $$ \frac{1}{1-\cos z} = \frac{1}{\frac{z^2}{2} + O(z^4)}\,\,\text{and}\,\, \tan z=\frac{z+O(z^3)}{1+\frac{z^2}{2}+O(z^4)} $$ I'm looking for an answer as the one obtained in the answer of: Principal Part of Laurent series' expansion of $f(z)=\frac{\sin(z^3)}{(1-\cos z)^3}$.
I understand the basic ideas behind the notation, but since I've never used the $O$ notation before I'd like a somehow detailed explanation (as formal as possible, like how it matters the center of the Taylor series) and if possible a general method.
Let us look at $\frac{1}{1-\cos z}$. Using your formula, you get: $$ \frac{1}{1-\cos z} = 2 z^{-2} \frac{1}{1+O(z^2)} = 2 z^{-2} (1+ O(z^2)) = 2 z^{-2} + O(1).$$
For $\cot z$ at $0$ (use basic trigonometry to get to your question), you get: $$\cot z = z^{-1} \frac{1+z^2/2+O(z^4)}{1 + O(z^2)} = z^{-1} (1+z^2/2+O(z^4))(1 + O(z^2)) = z^{-1} +O(z).$$
It might be useful to remember that $\frac{1}{1-x} = 1+x+x^2+...$, so $\frac{1}{1-O(z)} = 1+O(z)...$ and $\frac{1}{1-z +O(z)} = 1-z+O(z)+...$ and so on.