I'm trying to solve this equation below :
$$ y' = \sin\left(\frac{y}{x}\right) + \frac{y}{x} \tag 1 $$
The first step was to to substitute $\frac{y}{x}$ with $u$
=> $ u = \frac{y}{x}$ => $y' = u'x + u \tag 2$
Then with $(1) = (2)$, I got at the end
$$\dfrac{\ln\left(\cos\left(y\right)+1\right)-\ln\left(1-\cos\left(y\right)\right)}{2} = \ln|x| + C$$
And after more simplification : $$\frac{\cos(y)}{1-\cos(y)} = 2Cx $$
How can I get the general function from this equation ?
From your last line: $$\frac{\cos(y)+1}{1-\cos(y)} = Cx^2$$ $$\cos(y)+1 = Cx^2(1- \cos y)$$ $$ \cos y (1+Cx^2)=Cx^2-1$$ $$ \cos y =\dfrac {Cx^2-1}{ Cx^2+1}$$ $$\implies y(x)=\cos^{-1} \left ( \dfrac {Cx^2-1}{ Cx^2+1} \right)$$
Or more simply:
$$u'x= \sin u$$ $$\int \dfrac {du}{\sin u}=\int \dfrac {dx}{x}$$ $$-\ln (\cot u/2)=\ln x +K$$ $$\cot \dfrac u 2=\dfrac C x$$ $$u=2 \cot ^{-1} \left ( \dfrac Cx \right)$$ $$\boxed {y(x)=2x \cot ^{-1} \left ( \dfrac Cx \right)}$$
For the integral note that: $$I=\int \dfrac {dx}{\sin x }=\int \dfrac {dx}{2 \sin x/2 \cos x/2}$$ $$I=\int \dfrac 12\dfrac {\cos x/ 2dx}{\sin x/2 \cos ^2 x/2}$$ $$I=\int \dfrac {d \tan \dfrac x 2}{\tan \dfrac x2}=\ln \tan \dfrac x 2+C$$
Or you can use Weierstrass substitution $$\int \dfrac {dx}{\sin x} =\int \dfrac {1+t^2}{2t}\dfrac {2dt}{1+t^2} =\int \dfrac {dt}{t}=\ln t +C$$ Where $t=\tan \dfrac x 2$