If a is a real number and a cubic equation

f(x)=x^3−8x^2+(a+12)x−2a
has a repeated root, what is the sum of all the possible values of a?

The repeated root cannot be complex, nor can the other.

If f(x) = (x-h)^2 (x-k) then

x^3 - (2h+k)x^2 + (2hk+h^2)x - kh^2 = x^3-8x^2+(a+12)x-2a

so

2h+k = 8
h(2k+h) = a+12
kh^2 = 2a

k = 8-2h
h(16-3h) = a+12
h^2(4-h) = a

h(16-3h) = h^2(4-h) + 12
h^3 - 7h^2 + 16h - 12 = 0
(h-2)^2 (h-3) = 0

So,
h = 2 or 3
k = 4 or 2
a = 8 or 9