Answer
$a.\displaystyle \quad x^{2}+\frac{A}{x-1}+\frac{B}{(x-1)^{2}}$
$b.\displaystyle \quad \frac{A}{x}+\frac{Bx+C}{x^{2}+x+1}$
Work Step by Step
$a.$
The denominator is a perfect square, $(x-1)^{2}.$
The numerator has degree grreater than the denominator. Long division:
$ \begin{array}{llllll}
& x^{2} & & & & \\
& -- & -- & -- & -- & \\
(x^{2}-2x+1) & )x^{4} & -2x^{3} & +x^{2} & +2x & +1\\
& x^{4} & -2x^{3} & +x^{2} & & \\
& -- & -- & -- & & \\
& & & & +2x & +1\\
& & & & &
\end{array}$
$\displaystyle \frac{x^{4}-2x^{3}+x^{2}+2x-1}{x^{2}-2x+1}=x^{2}+\frac{2x+1}{(x-1)^{2}}$
The fraction has repeated factors,
$=x^{2}+\displaystyle \frac{A}{x-1}+\frac{B}{(x-1)^{2}}$.
$b.$
Factor the denominator.
$x^{3}+x^{2}+x=x(x^{2}+x+1)$
- no repeated factors; a quadratic factor.
$\displaystyle \frac{x^{2}-1}{x^{3}+x^{2}+x}=\frac{A}{x}+\frac{Bx+C}{x^{2}+x+1}$