Step 1: Compare the given integral form.
Given,
\[
\int (1+x)\log(1+x^2)\,dx=
\left(x+\frac{x^2}{2}+\frac{1}{2}\right)\log(1+x^2)+g(x)+C
\]
Differentiate both sides with respect to \(x\).
\[
(1+x)\log(1+x^2)
=
(1+x)\log(1+x^2)
+
\left(x+\frac{x^2}{2}+\frac{1}{2}\right)\frac{2x}{1+x^2}
+
g'(x)
\]
Step 2: Find \(g'(x)\).
Canceling \((1+x)\log(1+x^2)\) from both sides, we get
\[
g'(x)=-
\left(x+\frac{x^2}{2}+\frac{1}{2}\right)\frac{2x}{1+x^2}
\]
\[
g'(x)=-
\frac{x(x^2+2x+1)}{1+x^2}
\]
\[
g'(x)=-
\frac{x^3+2x^2+x}{1+x^2}
\]
Step 3: Simplify \(g'(x)\).
Now,
\[
\frac{x^3+2x^2+x}{1+x^2}
=
x+2-\frac{2}{1+x^2}
\]
Therefore,
\[
g'(x)=-
\left(x+2-\frac{2}{1+x^2}\right)
\]
\[
g'(x)=-x-2+\frac{2}{1+x^2}
\]
Step 4: Integrate to find \(g(x)\).
\[
g(x)=\int\left(-x-2+\frac{2}{1+x^2}\right)\,dx
\]
\[
g(x)=-\frac{x^2}{2}-2x+2\tan^{-1}x
\]
Thus,
\[
g(x)=-2x-\frac{x^2}{2}+2\tan^{-1}x
\]
Step 5: Final conclusion.
Therefore,
\[
\boxed{-2x-\frac{x^2}{2}+2\tan^{-1}x}
\]