Evaluating $\int_0^{\infty} \frac{\ln (x)}{1-x^n}\text{d}x$ This is just for recreational purposes.
I've been wondering how to evaluate the following integral:
$$\int_0^{\infty} \frac{\ln (x)}{1-x^n}\text{d}x$$
Because I noticed that certain values for $n$ lead to some nice rational multiples of $\pi^2$ when evaluated in WolframAlpha. This leads me to believe we should somehow get it into series form to turn it into something Basel-esque.  However, I've been struggling with this. I managed to put into series form a related integral, to at least show some kind of context/effort, which is:
$$\int_0^{1} \frac{\ln (x)}{1-x^n}\text{d}x$$
When inputting the series expansion of $1-x^n$, one simply needs to evaluate an integral of the form $x^{kn} \ln(x)$, which is simple, and the following series emerges:
$$\int_0^{1} \frac{\ln (x)}{1-x^n}\text{d}x = \sum_{k=0}^{\infty} \frac{1}{(kn+1)^2}$$
However, this approach doesn't work with bounds from $0$ to $\infty$ for obvious reasons. Could someone give me some help?
 A: It turns out that $\int_0^1\frac{\ln(x)}{1-x^a}\mathrm{d}x=-\frac{1}{a^2}\sum_{n=0}^{\infty}\frac{1}{(n+1/a)^2}$ (I think you dropped a minus sign). Enforcing the substitution $x\rightarrow 1/x$ yields $$\int_1^{\infty}\frac{\ln(x)}{1-x^a}\mathrm{d}x=\int_0^1\frac{x^{a-2}\ln(x)}{1-x^a}\mathrm{d}x=\sum_{n=0}^{\infty}\int_0^1\ln(x)x^{an+a-2}\mathrm{d}x=-\frac{1}{a^2}\sum_{n=0}^{\infty}\frac{1}{\big(n+1-1/a\big)^2}$$ Putting both pieces together yields $$\begin{eqnarray*}\int_0^{\infty}\frac{\ln(x)}{1-x^a}\mathrm{d}x&=&-\frac{1}{a^2}\Bigg[\sum_{n=0}^{\infty}\frac{1}{(n+1/a)^2}+\sum_{n=0}^{\infty}\frac{1}{(n+1-1/a)^2}\Bigg] \\ &=& -\frac{1}{a^2}\Bigg[\sum_{n=0}^{\infty}\frac{1}{(n+1/a)^2}+\sum_{n=1}^{\infty}\frac{1}{(-n+1/a)^2}\Bigg] \\ &=& -\frac{1}{a^2}\sum_{n=-\infty}^{\infty}\frac{1}{(n+1/a)^2} \end{eqnarray*}$$ It is a known result in complex analysis (using residues to evaluate sums of series) that for any $x\notin \mathbb{Z}$ we have $$\sum_{n=-\infty}^{\infty}\frac{1}{(n+x)^2}=\Big(\pi \csc(\pi x)\Big)^2$$ Taking $x$ to be $1/a$ yields $$\int_0^{\infty}\frac{\ln(x)}{1-x^a}\mathrm{d}x=-\frac{\pi^2}{a^2}\csc^2(\pi/a)$$
A: Considering the other half of the integral: $$I = \int_1^\infty {\frac{\ln(x)}{1-x^n}} \;dx$$
Let $x = u^{-1} \implies dx = -u^{-2} \; du$.
$$I = \int_1^0 {\frac{-\ln(u)}{1-u^{-n}}\cdot(-u^{-2})} \; du$$
$$ = \int_0^1 {\frac{u^{n-2}\ln(u)}{1-u^{n}}} \; du$$
$$ = \int_0^1 {\ln(u)\cdot\Bigg(u^{n-2}+u^{2n-2}+\dots\Bigg) \;du}$$
$$= -\sum_{k=1}^{\infty} \frac{1}{(kn-1)^2}$$
which is divergent for $n=1$. (I would be interested to know if both sums can be put together to get the closed form with $\csc$.)
A: @user429040 Already has an excellent answer. I'd like to expand a little bit on the sum formula that he has presented:
$$\sum_{k\in\Bbb{Z}}\frac{1}{(k+z)^2}=\pi^2\csc^2(\pi z)$$
How do we prove this formula? Well, first we expand it using partial fractions into two different sums:
$$\sum_{k\in\Bbb{Z}}\frac{1}{(k+z)^2}=\sum_{k=0}^\infty\frac{1}{(k+z)^2}+\sum_{k=0}^\infty\frac{1}{\big(k+(1-z)\big)^2}$$
Now we consider the polygamma function:
$$\psi^{(n)}(z):=\mathrm D^{n+1}(\log \Gamma)(z)=(-1)^{n+1}n!\sum_{k=0}^\infty \frac{1}{(k+z)^{n+1}}$$
The sum formula is proven in this excellent video from Flammable Maths. We can write this as
$$\sum_{k\in\Bbb{Z}}\frac{1}{(k+z)^2}=\psi^{(1)}(z)+\psi^{(1)}(1-z)$$
Let's let
$$f_n(z)=\psi^{(n)}(z)-(-1)^n\psi^{(n)}(1-z)$$
Now let $\mathrm I$ be the integral operator. Ignoring constants of integration for now (it can be shown they all vanish), we can see using the derivative definition of the polygamma that
$$\mathrm I^{n+1} f_n(z)=\log \Gamma(z)+\log\Gamma(1-z)$$
Using the laws of logarithms we have
$$\mathrm I^{n+1}f_n(z)=\log\big(\Gamma(z)\Gamma(1-z)\big)$$
But using Euler's reflection formula which is also proven by Flammable Maths we have
$$\mathrm I^{n+1}f_n(z)=\log\left(\frac{\pi}{\sin(\pi z)}\right)=\log(\pi)-\log(\sin(\pi z))$$
Taking a derivative on both sides,
$$\mathrm I^n f_n(z)=-\frac{1}{\sin(\pi z)}\cdot \cos(\pi z)\cdot \pi=-\pi\cot( \pi z)$$
Hence,
$$f_n(z)=\mathrm D^n(s\mapsto -\pi \cot(\pi s))(z)$$
Therefore
$$f_1(z)=\mathrm D(s\mapsto -\pi\cot(\pi s))(z)=\pi^2\csc^2 (\pi z)$$
