Closed form for $\sum_{r=0}^{n}(-1)^r {3n+1 \choose 3r+1} \cos ^{3n-3r}(x)\sin^{3r+1} (x)$ I request a closed form for the following sum $$S(n)=\sum_{r=0}^{n}(-1)^r {3n+1 \choose 3r+1} \cos ^{3n-3r}(x)\sin^{3r+1} (x) $$
I tried using De Moivre's theorem  $$\cos(nx)+i\sin(nx)=(\cos (x)+i\sin(x))^n $$
And we get by equating the imaginary parts of above equation $$\sin (nx)=\sum_{r=0}^{n}(-1)^r {n \choose 2r+1}\cos^{n-2r-1}(x)\sin^{2r+1}(x)$$
So we get $$\sin ((3n+1)x)=\sum_{r=0}^{n}(-1)^r {3n+1 \choose 2r+1}\cos^{3n-2r}(x)\sin^{2r+1}(x)$$
I am struggling to find a closed form for $S(n)$. Any help please.
 A: The command of Mathematica 13.1
FullSimplify[Sum[(-1)^r*Binomial[3*n + 1, 3 r + 1]*Cos[x]^(3 n - 3 r)*
Sin[x]^(3 r + 1), {r, 0, n}] // PowerExpand]

results in $$\frac{1}{3} \cos ^{3 n}(x) \left(\sin (x) (1-\tan (x))^{3 n}+\sin (x) \left(\sqrt[3]{-1} \tan (x)+1\right)^{3 n}-\cos (x) (1-\tan (x))^{3 n}-(-1)^{2/3} \cos (x) \left(\sqrt[3]{-1} \tan (x)+1\right)^{3 n}+\left(1-(-1)^{2/3} \tan (x)\right)^{3 n} \left(\sin (x)+\sqrt[3]{-1} \cos (x)\right)\right).$$
A: Hint
Start simplifying and write the expression as
$$S_n= \cos ^{3 n+1}(x)\sum_{r=0}^n (-1)^r\,\binom{3 n+1}{3 r+1} \,\tan ^{3 r+1}(x)$$
Let $t=\tan(x)$ and obtain something identical to what @user64494 already answered for.
$$T_n=\sum_{r=0}^n (-1)^r\binom{3 n+1}{3 r+1}\, t^{3r+1}=(-1)^n\,t\,P_n(u)\quad \text{with} \quad u=t^3$$  The first polynomials are
$$\left(
\begin{array}{cc}
n & P_n(u) \\
 0 & 1 \\
 1 & u-4 \\
 2 & u^2-35 u+7 \\
 3 & u^3-120 u^2+210 u-10 \\
 4 & u^4-286 u^3+1716 u^2-715 u+13 \\
 5 & u^5-560 u^4+8008 u^3-11440 u^2+1820 u-16 \\
 6 & u^6-969 u^5+27132 u^4-92378 u^3+50388 u^2-3876 u+19 \\
 7 & u^7-1540 u^6+74613 u^5-497420 u^4+646646 u^3-170544 u^2+7315
   u-22 \\
 \end{array}
\right)$$
