$\sin x-5\cos x=0,$
$\frac{\tan x\sin x}{\tan x}-5\frac{\sin x}{\tan x}=0,$
$\sin x(\tan x-5)=0$
$\sin x-5\cos x=0,$
$\frac{\tan x\sin x}{\tan x}-5\frac{\sin x}{\tan x}=0,$
$\sin x(\tan x-5)=0$
On
Note that when you write $$ \dfrac{\sin x}{\tan x} $$ you assume $\tan x\ne0$, which is the same as $\sin x\ne0$, and also that $\cos x\ne0$. So the equation can indeed be written $$ \sin x(\tan x-5)=0 $$ but subject to the added conditions that $\sin x\ne0$ and $\cos x\ne0$. You should check whether $\sin x=0$ or $\cos x=0$ produce solutions of the original equation (they don't).
So the equation is actually equivalent to $\tan x-5=0$. The angles $x$ that satisfy $\sin x=0$ are not solutions (because for them $\cos x\ne0$).
More simply, you can
You cannot multiply the equation by $\tan x$ when $\tan x$ ios $0$ or $\pm \infty$. So the solutions of your last equaltions are gauranteed to be the solutions of your initial equation only if $\tan x \neq 0$.
By multiplying by $\tan x$ you get extra solutions $x = n\pi$, beacuse for these $x$ you have $\tan x = 0$ and multiplying both sides of an equality by $0$ will produce $0=0$ which is always satisfied.