Concept:
Use the method of inspection. Let
\[
I=\int \frac{x^2-x+1}{x^2+1}\,e^{\cot^{-1}x}\,dx
=A(x)e^{\cot^{-1}x}+C.
\]
Differentiate both sides and determine \(A(x)\).
Step 1: Differentiate the right-hand side.
Since
\[
\frac{d}{dx}\big(\cot^{-1}x\big)
=
-\frac{1}{1+x^2},
\]
we get
\[
\frac{d}{dx}
\left(
A(x)e^{\cot^{-1}x}
\right)
=
e^{\cot^{-1}x}
\left(
A'(x)-\frac{A(x)}{1+x^2}
\right).
\]
This must equal the integrand:
\[
e^{\cot^{-1}x}
\frac{x^2-x+1}{x^2+1}.
\]
Hence,
\[
A'(x)-\frac{A(x)}{1+x^2}
=
\frac{x^2-x+1}{x^2+1}.
\]
Step 2: Test the given options.
Take
\[
A(x)=x.
\]
Then
\[
A'(x)=1.
\]
Therefore,
\[
A'(x)-\frac{A(x)}{1+x^2}
=
1-\frac{x}{1+x^2}.
\]
\[
=
\frac{1+x^2-x}{1+x^2}.
\]
\[
=
\frac{x^2-x+1}{x^2+1}.
\]
This exactly matches the integrand.
Hence,
\[
A(x)=x.
\]
Therefore,
\[
\boxed{A(x)=x}
\]
\[
\boxed{\text{Answer = (B)}}
\]