You can use the method of long division. Here we show an alternative method.
The question tells us we can write:
\[\frac{f(x)}{g(x)}=\simplify[std]{(x ^ 4 + {a1} * x ^ 3 + {b1} * x^2 + {c1}x+{d1})/(x^2+{e1})=q(x)+r(x)/(x^2+{e1})}\;\;\;\dots(1)\]
Since the degree of $f(x)$ is $4$ and the degree of $g(x)$ is $2$, the degree of $q(x)$ is $2$ and we can write $q(x)=Ax^2+Bx+C$ for constants $A,\;B,\;C$.
The degree of $r(x)$ is less than $2$ hence $r(x)=Dx+E$ for constants $D,\;E$.
Multiplying both sides of (1) by $\simplify[std]{x^2+{e1}}$ gives:
\[\simplify[std]{x ^ 4 + {a1} * x ^ 3 + {b1} * x^2 + {c1}x+{d1}=(Ax^2+Bx+C)(x^2+{e1})+Dx}+E\]
We can then compare coefficients to determine the constants $A,\;B,\;C,\;D,\;E$.
Terms in $x^4$
$A=1$
Terms in $x^3$
$B=\var{a1}$
Terms in $x^2$
$\simplify[std]{{e1}A+C = {b1}} \Rightarrow C = \var{b1-e1}$
Terms in $x$
$\simplify[std]{{e1}B+D = {c1}} \Rightarrow D = \var{c1-a1*e1}$
Constant terms
$\simplify[std]{{e1}C}+E= \var{d1} \Rightarrow E = \var{d1-(b1-e1)*e1}$
Therefore:
\[\frac{f(x)}{g(x)}=\simplify[std]{x ^ 2 + {a1} *x + {b1 -e1}+({c1-a1*e1}*x+{d1-e1*(b1-e1)})/(x^2+{e1})}\]