Answer
$$(x+1)[\ln (x+1)]^{2}-2(x+1) \ln (x+1)+2(x+1)+C$$
Work Step by Step
Given $$\int(\ln (x+1))^{2} d x$$
Let
\begin{align*}
u&=(\ln (x+1))^{2} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ dv=dx\\
du&=2\ln (x+1)\frac{1}{1+x}dx \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ v=x
\end{align*}
Then
\begin{align*}
\int(\ln (x+1))^{2} d x&=x(\ln (x+1))^{2}-2\int \ln (x+1) \frac{x}{x+1}dx
\end{align*}
Let
\begin{align*}
u&=\ln (x+1) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ dv= \frac{x}{x+1}dx\\
du&= \frac{1}{1+x}dx \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ v=x+\ln (x+1)
\end{align*}
Then
\begin{align*}
\int \ln (x+1) \frac{x}{x+1}dx&= [x+\ln (x+1)]\ln (x+1) -\int[x+\ln (x+1)] \frac{1}{1+x}dx\\
&= [x+\ln (x+1)]\ln (x+1) -[x+\ln (x+1)] -\frac{1}{2}[\ln (x+1)]^2+C
\end{align*}
Hence
$$ \int(\ln (x+1))^{2} d x=(x+1)[\ln (x+1)]^{2}-2(x+1) \ln (x+1)+2(x+1)+C$$