This question asks in effect to show that $\eta^n$ is a $\pm p^{n/2}$
eigenfunction for the Hecke operator $T_p$. The claim holds because
each of these $\eta^n$ happens to be a CM form of weight $n/2$,
and $p$ is inert in the CM field ${\bf Q}(i)$ or ${\bf Q}(\sqrt{-3})$.
In plainer language, the sum over $k$ takes the $q$-expandion
$$
\eta(\tau)^n = \sum_{m \equiv n/24 \phantom.\bmod 1} a_m q^m
$$
and picks out the terms with $p|m$, multiplying each of them by $p$;
and the result is predictable because the only $m$ that occur are
of the form $(a^2+b^2)/d$ or $(a^2+ab+b^2)/d$ where $d = 24 / \gcd(n,24)$,
and the congruence on $p$ implies that $p|m$ if and only if $p|a$ and $p|b$.

For $n=2$ this is immediate from the
pentagonal
number identity,
which states in effect that $\eta(\tau)$ is the sum of $\pm q^{c^2/24}$
over integers $c \equiv 1 \bmod 6$, with the sign depending on $c \bmod 12$
(and $q = e^{2\pi i \tau}$ as usual). Thus
$$
\eta^2 = \sum_{c_1^{\phantom0},c_2^{\phantom0}}
\pm q^{(c_1^2+c_2^2)/24} = \sum_{a,b} \pm q^{(a^2+b^2)/12}
$$
where $c,c' = a \pm b$.

Once $n>2$ there's a new wrinkle: the coefficient of each term
$q^{(a^2+b^2)/d}$ or $q^{(a^2+ab+b^2)/d}$ is not just $\pm 1$
but a certain homogeneous polynomial of degree $(n-2)/2$ in $a$ and $b$
(a harmonic polynomial with respect to the quadratic form $a^2+b^2$ or
$a^2+ab+b^2$). Explicitly, we may obtain the CM forms $\eta^n$ as follows:

@ For $n=4$, sum $\frac12 (a+2b) q^{(a^2+ab+b^2)/6}$ over all $a,b$ such that
$a$ is odd and $a-b \equiv1 \bmod 3$. [This is closely related with the
fact that $\eta(6\tau)^4$ is the modular form of level $36$ associated to
the CM elliptic curve $Y^2 = X^3 + 1$, which happens to be isomorphic with
the modular curve $X_0(36)$.]

@ For $n=6$, sum $(a^2-b^2) q^{(a^2+b^2)/4}$ over all $a \equiv 1 \bmod 4$
and $b \equiv 0 \bmod 2$.

@ For $n=8$, sum $\frac12 (a-b)(2a+b)(a+2b) q^{(a^2+ab+b^2)/3}$
over all $(a,b)$ congruent to $(1,0) \bmod 3$.

@ For $n=10$, sum $ab(a^2-b^2) q^{(a^2+b^2)/12}$
over all $(a,b)$ congruent to $(2,1) \bmod 6$.

@ Finally, for $n=14$, sum
$\frac1{120} ab(a+b)(a-b)(a+2b)(2a+b)q^{(a^2+ab+b^2)/12}$
over all $a,b$ such that $a \equiv 1 \bmod 4$ and $a-b \equiv 4 \bmod 12$.

I can't give a reference for these identities, but once such a formula
has been surmised it can be verified by showing that the sum over $a,b$
gives a modular form of weight $n/2$ and checking that it agrees with
$\eta^n$ to enough terms that it must be the same.

d= 1 to 1000. $\endgroup$