Is the following Differential Equation undefined for given values of X & Y? I have been presented with the following differential equation which I'm asked to solve, where $y=0$ when $x=\pi$. $$(y+1)\sin x\frac{dy}{dx} = (y^2+1)\tan^2x$$
I notice that $(y^2+1)$ may be expressed as $(y+1)(y-1)$ in order to be able to cut with the $(y+1$ on the opposing side which boils down to: $$\sin x\frac{dy}{dx} = (y-1)\tan^2x$$
I then seperate the variables accordingly to get one side in terms of $dy$ and the other side in terms of $dx$ $$\frac{1}{(y-1)}dy = \frac{1}{\sin  x}\tan^2xdx$$ 
and my final presentation of the above differential prior to integrating ended up being $$\int \frac{1}{(y-1)} dy = \int \frac{\sin x}{\cos^2 x}dx$$
Not to bore you through my entire integration method I will give my results for now. If they are incorrect or the steps I took are requested I'll gladly provide them.
$$LHS = \ln \left | y-1 \right | + C$$ 
$$RHS = \frac{\sec x}{2} + C$$
$$\ln \left | y-1 \right | = \frac{\sec x}{2} + C$$

Now solving for the above result does not seem to make all too much sense to me as it seems to be undefined (though looks odd if the question requests an undefined set of values for x & y)

Right Hand Side (RHS)
The following are my steps when simplifying the RHS of the previous integral.
$\int \frac{\sin x}{\cos^2x} = \int \frac{1}{ \cos x } \tan xdx = \int \sec x \ tan x dx$. From here I applied Integration by parts.
$$u = \sec x$$ $$\frac{dv}{dx} = \tan x$$ $$\frac{du}{dx} = \sec x \tan x$$ $$v = \ln \left | \sec x \right |$$
$\sec x \ln | \sec x | - \int \tan x \sec x \ln | \sec x |$
$\ln |\sec x|^{\sec x} - \int \tan x \ln |\sec x|^{\sec x}$
$\sec x - \int \tan x \sec x = \int \tan x \sec x dx$
$\therefore \sec x = 2\int \tan x \sec x dx$
$\frac{\sec x }{2} = \int \tan x \sec x dx$
 A: Is there a typing mistake in the wording of the question ? You write :
$$(y+1)\sin x\frac{dy}{dx} = (y^2+1)\tan^2x$$
But after, you write $(y^2+1)=(y+1)(y-1)$ which is false. May be, the equation is :
$$(y+1)\sin x\frac{dy}{dx} = (y^2-1)\tan^2x$$
Anyway, in both cases, the ODE is separable.
1.
If it is $(y+1)\sin x\frac{dy}{dx} = (y^2-1)\tan^2x$ then :
$$\frac{1}{y-1}dy = \frac{\sin(x)}{\cos^2(x)} dx$$
I let you continue the integration which is easy.
2.
If it is $(y+1)\sin x\frac{dy}{dx} = (y^2+1)\tan^2x$ then :
$$\frac{y+1}{y^2+1}dy = \frac{\sin(x)}{\cos^2(x)} dx$$
Hit : An antiderivative of $\frac{y+1}{y^2+1}$ is $\frac{1}{2}\ln(y^2+1)+\tan^{-1}(y)$ So, I let you continue. You will be able to express $x$ as a function of $y$, but not the inverse function.
NOTE :
The original ODE $(y+1)\sin x\frac{dy}{dx} = (y^2+1)\tan^2x$ and the "supposed" one $(y+1)\sin x\frac{dy}{dx} = (y^2+1)\tan^2x$ , both in addition have a lot of trivial solutions :
$$\sin(x)=0$$
$$x(y)=n\pi$$
A: If there was a typo in the ODE, here is the solution, if not, see below for a solution to the ODE as it is written:
Formally inverting what you have there (after fixing the RHS) we get
$$|y-1| = \exp(\sec x + C) = \tilde C \exp(\sec x)$$
And thus
$$y = 1 \pm \tilde C\exp(\sec x) = 1 + \bar C \exp(\sec x)$$
Now we plug in the IVP $y = 0, x=\pi$ to see that
$$0 = 1 + \bar C \exp(\sec \pi) = 1 + \bar C e^{-1} \Rightarrow \bar C = -e$$
This yields the solution
$$y(x) = 1 - e \exp(\sec x) = 1 - \exp(\sec x + 1)$$

However this does not solve the original IVP because $y^2 + 1 = (y+i)(y-i) \ne (y+1)(y-1)$ as noted by @EmilioNovati. Fixing this results in a different LHS but the same RHS. Thus we obtain
$$\int \frac{y+1}{y^2 + 1} \ \mathrm dy = \sec x + C$$
The integral can be solved seperating
$$\int \frac y{y^2+1} \ \mathrm dy = \frac12 \ln (y^2 + 1) + C$$
and
$$\int \frac1{y^2+1} \ \mathrm dy = \arctan y + C$$
Thus we need to solve
$$\frac12\ln(y^2 + 1) + \arctan y = \sec x + C$$
For this we should use the complex logarithm so that $\arctan y = \frac1{2i} \ln(\frac{y-i}{y+i}) + C$ wich allows us to collapse the LHS to one complex logarithm.
