Usually in these problems, I will first analyze the denominator polynomial $g(x)=x^2-x-2$.
The roots of this polynomial are: $$g(x)=(x-2)(x+1)=0$$
giving, $x=-1,2$. Now the second thing I do is I check whether the numerator polynomial is having a common root. So we check $f(x)=2x^4-5x^3-15x^2+10x+8$, for $x=-1,2$.
$f(-1)=-10$ and $f(2)=-40$, so none of the roots are common telling that this division will lead to a remainder.
The next thing I would do is just take $(x-2)$ common from $f(x)$ like this (take common whatever is remaining you just add to make it equal to $f(x)$):
$$f(x)=2x^3(x-2)-x^2(x-2)-17x(x-2)-24(x-2)-40$$
$$\frac{f(x)}{g(x)}=\frac{2x^3(x-2)-x^2(x-2)-17x(x-2)-24(x-2)-40}{(x-2)(x+1)}$$
$$\frac{f(x)}{g(x)}=\frac{2x^3-x^2-17x-24}{x+1}-\frac{40}{(x-2)(x+1)}$$
For the first part do the same thing again. Take $(x+1)$ common to get:
$$2x^2(x+1)-3x(x+1)-14(x+1)-10$$
$$\frac{f(x)}{g(x)}=\frac{(2x^2-3x-14)(x+1)}{x+1}-\frac{10}{x+1}+\frac{40}{(x-2)(x+1)}$$
$$\frac{f(x)}{g(x)}=2x^2-3x-14-\frac{10}{x+1}-\frac{40}{(x-2)(x+1)}$$
This is the final answer for your division. You can also club the last two terms so that you get a common denominator function.
$$\frac{f(x)}{g(x)}=2x^2-3x-14-\frac{10(x+2)}{(x-2)(x+1)}$$
You can also try synthetic division which is far more easier but for that you need to have a good hold on the concept of long division.
Hope this helps.....