I like to long divide the coefficients, not forgetting to include #0#'s for any missing powers of #x# ...
This is similar to long division of numbers.
Write the dividend #1, 2, 0, 3, -1# under the bar and the divisor #1, 0, 2# to the left of the bar.
Write the first term #color(blue)(1)# of the quotient above the bar, choosing it so that when multiplied by the divisor it matches the leading term #1# of the dividend.
Write the product #1, 0, 2# of this first term and the divisor under the dividend and subtract it. Then bring down the next term of the dividend alongside it.
Write the second term #color(blue)(2)# of the quotient above the bar, choosing it so that when multiplied by the divisor it matches the leading term #2# of the running remainder.
Write the product #2, 0, 4# of this second term and the divisor under the running remainder and subtract it. Then bring down the next term of the dividend alongside it.
Write the third term #color(blue)(-2)# of the quotient above the bar, choosing it so that when multiplied by the divisor it matches the leading term #-2# of the running remainder.
Write the product #-2, 0, -4# of this third term and the divisor under the running remainder and subtract it to give #color(purple)(-1, 3)#.
This is where we stop, since the running remainder is now shorter than the divisor and there are no more terms to bring down from the dividend.
The resulting quotient is #1, 2, -2#, meaning #x^2+2x-2# and final remainder #-1, 3#, meaning #-x+3#
So:
#(x^4+2x^3+3x-1)/(x^2+2) = x^2+2x-2+(-x+3)/(x^2+2)#
Or if you prefer:
#x^4+2x^3+3x-1#
#= (x^2+2)(x^2+2x-2) + (-x+3)#