If x+2 is a factor then the other factor can be represented by x^4+ax^3+bx^2+cx+d. Multiply this by x+2:
x^5+ax^4+bx^3+cx^2+dx + 2x^4+2ax^3+2bx^2+2cx+2d.
Compare this with x^5+kx^4-x^2-kx-4 and match the coefficients.
x^4: a+2=k; x^3: b+2a=0; x^2: c+2b=-1; x: d+2c=-k; constant: 2d=-4.
So d=-2; -2+2c=-k, c=(1/2)(2-k); 2b=-1-c=-(1+(1/2)(2-k)), b=-(1/2)(1+(1/2)(2-k)); a=-b/2=(1/4)(1+(1/2)(2-k)).
a+2=k so (1/4)(1+(1/2)(2-k))+2=k.
1+(1/2)(2-k)+8=4k; 2+2-k+16=8k; 9k=20, k=20/9. So a=20/9-2=2/9; b=-2a=-4/9; c=-1-2b=-1+8/9=-1/9.
CHECK: (x+2)(x^4+2x^3/9-4x^2/9-x/9-2)=x^5+2x^4/9-4x^3/9-x^2/9-2x+2x^4+4x^3/9-8x^2/9-2x/9-4.
x^5+20/9x^4-x^2-20x/9-4. This confirms that k=20/9.
ALTERNATIVE METHOD USING SYNTHETIC DIVISION
This method is simpler:
-2 | 1....k.........0....-1.........-k...........-4
......1...-2 -2k+4 4k-8 -8k+18...18k-36
......1 k-2 -2k+4 4k-9 -9k+18 | 18k-40
The remainder has to be zero, so 18k-40=0, k=40/18=20/9.