Reduce the numbers in the list modulo 3 to get the set
{1, 2, 0, 1, 2, 0, …, 1, 2, 0}
containing [tex]k[/tex] copies each of 1, 2, and 0.
Take any 3 elements from the list. Their sum is divisible by 3 if those elements' residues also sum to 3 ≡ 0 (mod 3). To get a sum of 0, we must make one of the following choices:
0 + 0 + 0 ≡ 0 (mod 3)
1 + 1 + 1 ≡ 3 ≡ 0 (mod 3)
2 + 2 + 2 ≡ 6 ≡ 0 (mod 3)
0 + 1 + 2 ≡ 3 ≡ 0 (mod 3)
There are
[tex]\dbinom k3 \dbinom k0 \dbinom k0 = \dfrac{k(k-1)(k-2)}6[/tex]
ways of choosing 3 elements with a given residue and 0 elements with any other residue, hence
[tex]3\dbinom k3\dbinom k0\dbinom k0 = \dfrac{k(k-1)(k-2)}2[/tex]
ways of choosing any 3 elements with the same residue, and there are
[tex]\dbinom k1 \dbinom k1 \dbinom k1 = k^3[/tex]
ways of choosing any 3 elements with distinct residues.
So, the total number of ways of making the selection is
[tex]3\dbinom k3\dbinom k0^2 + \dbinom k1^3 = \boxed{\dfrac32 k^3 - \dfrac32 k^2 - k}[/tex]