Problem: Solve the differential equation
\[
(x + 1) \frac{\mathrm{d}y}{\mathrm{d}x} - ny = e^x (x+ 1)^{n+1}, \ y(0) = 1
\]
where $n \in \mathbb{N} $.
Solution: Rewriting the given differential equation as
\[
\frac{\mathrm{d}y}{\mathrm{d}x} - \frac{n}{x+1} y = e^x (x+1)^n.
\]
The above one is a linear differential equation and this an be solved by finding the integrating factor.
\begin{align*}
I & = e^{\int -\frac{n}{x+1} \mathrm{d}x } = e^{-n \ln (x+1)} = (x+1)^{-n}.
\end{align*}
Multiplying the given differential equation with the integrating factor gives
\begin{align*}
& (x+1)^{-n}\frac{\mathrm{d}y}{\mathrm{d}x} - n (x+1)^{-n-1} y = e^{x} \\
\implies & \frac{\mathrm{d}}{\mathrm{d}x} \left( y (x+1)^{-n} \right) \equiv e^{x} \\
\implies & y (x+1)^{-n} = \int e^x \mathrm{d} x + c \\
\implies & y (x+1)^{-n} = e^{x} + c \\
\implies & y = (x + 1)^n e^x + c (x+1)^n.
\end{align*}
Now we will use the initial condition to find the value of $c$.
\begin{align*}
y(0) = 1 & \implies 1 = 1 + c \implies c = 0.
\end{align*}
Thus, the solution of the given differential equation will be
\[
y = (x+1)^n e^x .
\]