TITLE: Integral $\int_0^1 \int_0^1 \cdots \int_0^1\frac{x_{1}^2+x_{2}^2+\cdots+x_{n}^2}{x_{1}+x_{2}+\cdots+x_{n}}dx_{1}\, dx_{2}\cdots \, dx_{n}=?$
QUESTION [25 upvotes]: How to evaluate this integral:
$$\int_0^1 \int_0^1 \cdots \int_0^1\frac{x_{1}^2+x_{2}^2+\cdots+x_{n}^2}{x_{1}+x_{2}+\cdots+x_{n}}dx_{1}\, dx_{2}\cdots \, dx_{n}=?$$
I'm making use of the integral identity:
$$\int_{0}^{+\infty }e^{-t(x_{1}+x_{2}\cdots +x_{n})}dt=\frac{1}{x_{1}+x_{2}\cdots +x_{n}}$$ and then reversing the order of integration with respect to time and space variables.
But for $n=1$, then such that, $$\int_{0}^{\infty }dt\int_{0}^{1}x^{2}e^{-tx}dx=\int_{0}^{\infty }\frac{2 - e^{-t}(2 + 2t+t^2)}{t^3}dt=\int_{0}^{1}x\,dx=\frac{1}{2},$$ and $$\int_0^1 \int_0^1 \cdots \int_0^1\frac{x_{1}^2+x_{2}^2+\cdots+x_{n}^2}{x_{1}+x_{2}+\cdots+x_{n}}dx_{1}\, dx_{2}\cdots \, dx_{n}\\=n\int_{0}^{+\infty }\frac{2 - e^{-t}\left ( 2 + 2t+t^2 \right )}{t^3}\left ( \frac{1-e^{-t}}{t} \right )^{n-1}dt.$$

REPLY [12 votes]: Here is another approach, which also gives the rational term.
(I) To see how it works let $n\geq 2$ and consider first
the simpler case 
\begin{align*}
\mathbb{E}\bigg(\frac{1}{X_1+\ldots+X_n}\bigg)=\int_0^\infty \bigg(\frac{1-e^{-t}}{t}\bigg)^n\,dt 
\end{align*}
Using $\frac{1}{t^n}=\int_0^\infty \frac{z^{n-1}}{(n-1)!} e^{-zt}\,dz$ we find
\begin{align*}
\int_0^\infty \bigg(\frac{1-e^{-t}}{t}\bigg)^n\,dt&=\int_0^\infty\int_0^\infty \frac{z^{n-1}}{(n-1)!} e^{-zt}(1-e^{-t})^n\, dz\,dt\\
&=\int_0^\infty\int_0^\infty \frac{z^{n-1}}{(n-1)!} e^{-zt}(1-e^{-t})^n\, dt\,dz\\
&=\int_0^\infty \frac{z^{n-1}}{(n-1)!}\, \mathrm{Beta}(z,n+1)\,dz\\
&=n\,\int_0^\infty \frac{z^{n-1}}{z(z+1)\cdots(z+n)}\,dz
\end{align*}
The following observation will be the key:
Lemma: let $x_0,\ldots,x_n$ be distinct positive numbers and $k\leq n-1$. Then
$$I_{k,n}(x_0,\ldots,x_n):=\int_0^\infty \frac{z^{k}}{(z+x_0)(z+x_1)\cdots(z+x_n)}\,dz=(-1)^{n+k+1}\Delta^n(x^k\log(x);x_0,\ldots,x_n)$$
where (for a real function $f$) $\Delta^n(f;x_0,\ldots,x_n)$
denotes the divided difference of $f$ corresponding to $x_0,\ldots,x_n$.
Recall that (Newton-interpolation)
(1) the divided differences are for $f$ and mutually distinct $x_0,\ldots,x_n$ are defined recursively by 
$\Delta^0(f;x_0)=f(x_0)$,
$\Delta^n(f;x_0,\ldots,x_n)=\frac{\Delta^{n-1}(f; x_1,\ldots,x_n)-\Delta^{n-1}(f; x_0,\ldots,x_{n-1})}{x_n-x_0}$
(2) they  are explicitly
given by $$\Delta^n(f;x_0,\ldots,x_n)=\sum_{i=0}^n \frac{f(x_i)}{\prod_{j\neq i} (x_i-x_j)}\;\;(**)$$
(3)  $$\Delta^n(f;x,x+1,\ldots,x+n)=\frac{1}{n!} \sum_{i=0}^n {n \choose i} (-1)^{n-i} f(x+i)$$
Proof of the lemma:
For  $k=0, n=1$ we have  $$\int_0^\infty \frac{1}{(z+x_0)(z+x_1)}=\frac{\log(x_1)-\log(x_0)}{x_1-x_0}=\Delta^1(\log(x);,x_0,x_1)$$
For $k=0,n>1$ the repeated use of $\frac{1}{(z+a)(z+b)}=\frac{-1}{b-a}\left(\frac{1}{z+b}-\frac{1}{z+a}\right)$ shows that $(-1)^{n+1}I_{0,n}(x)=\Delta^n(\log(x),x)$.
The validity for $k>0,n=k+1$ follows from $\frac{z}{z+b}=1-\frac{b}{z+b}$ and $(**)$. End of proof.
The lemma and (3) now give that
\begin{align*}
 \int_0^\infty \bigg(\frac{1-e^{-t}}{t}\bigg)^n\,dt &=n \Delta^{n-1}(x^{n-2}\log(x);x+1,x+2,\ldots,x+n)\\
  &=\frac{n}{(n-1)!}\sum_{i=0}^{n-1}{ n-1 \choose i} (-1)^{n-1-i} (i+1)^{n-2}\log(i+1)
\end{align*}
(II) Now let $n\geq 1$ and consider
$$ Q_{n+1}:=\mathbb{E}\bigg(\frac{X_1^2+\ldots + X_{n+1}^2}{X_1+\ldots+X_{n+1}}\bigg)$$
Write 
$$Q_{n+1}=(n+1)\int_0^1 u^2 \bigg(\int_0^\infty  e^{-ut}\bigg(\frac{1-e^{-t}}{t}\bigg)^n\,dt\bigg)\,du$$
 Proceeding as above shows that for $u>0$
\begin{align*}
 \int_0^\infty e^{-ut}\bigg(\frac{1-e^{-t}}{t}\bigg)^n\,dt
&=\frac{n}{n!} \sum_{i=0}^n {n \choose i} (-1)^{n-i} (u+i)^{n-1}\log(u+i)
\end{align*}
Thus
$$q_{n+1}:=\frac{Q_{n+1}}{n(n+1)}=\frac{1}{n!} \sum_{i=0}^n {n \choose i} (-1)^{n-i} \int_0^1 u^2(u+i)^{n-1}\log(u+i)\,du$$
Now expand $u^2=(u+i-i)^2$ and integrate partial to find 
that $q_{n+1}=L-R$
where $L=\frac{1}{n!}\sum_{i=0}^n{n\choose i}(-1)^{n-i} \ell(i),\;R=\frac{1}{n!}\sum_{i=0}^n {n  \choose i}(-1)^{n-i} r(i)$ with
\begin{align*}
 \ell(i)=&\frac{1}{n+2}\left((i+1)^{n+2}\log(i+1)-i^{n+2}\log(i)\right)\\
  &-\frac{2i}{n+1}\left((i+1)^{n+1}\log(i+1)-i^{n+1}\log(i)\right)\\
  &+\frac{i^2}{n}\left((i+1)^{n}\log(i+1)-i^n\log(i)\right)\\[0.2cm]
 r(i)=&\frac{1}{(n+2)^2}\left((i+1)^{n+2}-i^{n+2}\right)\\
      &-\frac{2i}{(n+1)^2}\left((i+1)^{n+1}-i^{n+1}\right)\\
      &+\frac{i^2}{n^2}\left((i+1)^{n}-i^n\right)
\end{align*}
Collecting terms in the logarithmic part $L$ shows that the coefficient of $\log(i)$ in $q_{n+1}$ is $c_{i,n+1} =(-1)^{n-i} \frac{i^n}{n}{ n \choose i-1}\left(\frac{n^2+3n+2-2i}{(n+2)!}\right)$, matching Fedor Petrov's answer.
The rational part $R$ can readily be summed (note that only the contributions of the powers $n$ and $n+1$ (with coefficients $-\frac{1}{n(n+1)(n+2)}$ and $\frac{2}{n(n+1)(n+2)}$) need to be considered) to
give $$R=\frac{1}{n+2}-\frac{1}{n(n+1)(n+2)}\;\;,$$
so that the rational term of $Q_{n+1}$ is $-\frac{n(n+1)-1}{n+2}=-\frac{(n+2)(n-1)+1}{n+2}$, confirming Sylvain JULIEN's guess.