[tex]\dfrac{5x-2}{(x-1)^2}=\dfrac a{x-1}+\dfrac b{(x-1)^2}[/tex]
[tex]5x-2=a(x-1)+b[/tex]
Since [tex]5x-2=5x-5+3=5(x-1)+3[/tex], it follows that [tex]a=5[/tex] and [tex]b=3[/tex], so
[tex]\dfrac{5x-2}{(x-1)^2}=\dfrac5{x-1}+\dfrac3{(x-1)^2}[/tex]
[tex]\dfrac{x^3+x^2+x+2}{x^4+x^2}=\dfrac{x^3+x+x+2}{x^2(x^2+1)}=\dfrac ax+\dfrac b{x^2}+\dfrac{cx+d}{x^2+1}[/tex]
[tex]x^3+x^2+x+2=ax(x^2+1)+b(x^2+1)+(cx+d)x^2[/tex]
[tex]x^3+x^2+x+2=(a+c)x^3+(b+d)x^2+ax+b[/tex]
When [tex]x=0[/tex], you find that [tex]b=2[/tex]. It's also clear that [tex]a=1[/tex]. So the remaining constants must be [tex]1+c=1\implies c=0[/tex] and [tex]2+d=1\implies d=-1[/tex], and so you get
[tex]\dfrac{x^3+x^2+x+2}{x^4+x^2}=\dfrac1x+\dfrac2{x^2}-\dfrac1{x^2+1}[/tex]