I was trying to evaluate $\int_{0}^{\infty}{\frac{\cos(tx^n)}{x^n+a}\, dx}$, with a semicircle in the upper half plane we have :
$$\oint{\frac{e^{itz^n}}{z^n+a}\, dz}=\int_{-\infty}^{\infty}{\frac{e^{itx^n}}{x^n+a}\, dx}+\int_{\Gamma}{f(z)\, dz=2\pi i\sum{\mathrm{Res}f(z)}}$$
I think $\int_{\Gamma}\to0$ as the radius goes to infinity. Then the residue when $z^n+a=0$ :
$$\begin{align}\lim_{z\to a^{1/n}e^{\frac{i\pi}{n}(2k+1)}}{(z-a^{1/n}e^{\frac{i\pi}{n}(2k+1)})}\frac{e^{itz^n}}{z^n+a}=\frac{e^{itae^{i\pi(2k+1)}}}{n(a^{1/n}e^{\frac{i\pi}{n}(2k+1)})^{n-1}}=-a^{1/n-1}n^{-1}e^{-ita}e^{\frac{i\pi}{n}(2k+1)}\end{align}$$
But after summing, it doesn't seem like this arrives at the answer given here. Specifically the $\csc(\frac{\pi}{n})$.
EDIT : Since part of the numerator of $\sum_{k=0}^{n-1}{e^{\frac{i\pi}{n}(2k+1)}}$ is $1-e^{2\pi i}=0$
The linked answer is alleged to be incorrect on numerical grounds (see comments). It's also quite unrigorous; it uses non-convergent integrals in at least one place. I suspect it is simply wrong.
I don't yet have an evaluation for the integral, but I can explain why your method probably doesn't work. At the very least, to make sure it works you'd need to do a lot of hard work convincing me that the arc integral vanishes.
A serious issue with your approach is that it's not obvious that $\int_{\Gamma}$ goes to zero, and it probably doesn't.
You're probably used to $\int_{\Gamma}$ vanishing when we have functions of the form: $$z\mapsto e^{iz}f(z)$$Because in the upper half plane, all the imaginary parts are positive; thus, the real parts of $iz$ are all negative (and large) and you can expect the exponential term to decay sufficiently quickly.
But with $z\mapsto e^{iz^n}f(z)$, it's not so simple. Visualise $z\to z^n$ as a stretch on the unit circle; each sector of angle $2\pi/n$ is blown up to the entire circle. In particular, the semicircle (of angle $\pi$) is blown up and wraps around the unit circle $\lfloor n/2\rfloor$ times. This is $\ge1$ when $n\ge2$, so we wrap around the circle at least once.
Long story short, the imaginary parts of $z^n$ are not always positive if you take $z$ in the upper half plane, so $e^{iz^n}$ does not experience exponential decay. Rather, it will decay on some subsectors of $\Gamma$ and blow up on the others; so, the usual argument wouldn't show $\int_{\Gamma}\to0$ as the radius tends to infinity.
In some cases, the use instead of a wedge contour with angle $\le\pi/n$ (so that $e^{iz^n}$ decays on the arc) works as an alternative. I don't think it works here.