Limit of fourier series I want to compute the limit $f(x)$ of
$$
f(n,x)=\sum_{k=1}^n\frac{1}{k^2+1}\sin(kx)
$$
and didn't succeed. I tried with the means used to compute the >>easy<< limits of trigonometric series like those listed in (e.g.) Bronstein, however, the above series is not in Bronstein. I plotted the graph with sagemath (see my post on ask.sagemath.org: https://ask.sagemath.org/question/55596/limit-of-fourier-series/). At least this suggests that f(x) exists and is not a polynomial.
Is it possible to compute the above limit and if so, how?
 A: The answer was already given in terms of the hypergeometric function.
Here I'd like to make some remarks which might be useful to understand the sum better.
Let us first study the convergence of the sum
$$s(x) = \sum_{k=1}^\infty \frac{\sin(k x)}{1+k^2}$$
and then tun to some related sums to get a better feeling of the behaviour $s$.
We have the estimates
$$|s| \lt \sum_{k=1}^\infty \frac{|\sin(k x)|}{1+k^2}\\\lt \sum_{k=1}^\infty \frac{1}{1+k^2}=\frac{1}{2}\sum_{k=-\infty}^\infty \frac{1}{1+k^2}-\frac{1}{2}=\frac{1}{2}\left(\pi \coth(\pi)-1 \right)\simeq 1.07667\\\lt \sum_{k=1}^\infty \frac{1}{k^2}=\zeta(2) \simeq 1.64493$$
While the maximum is given (numerically) by $$s_{max}\simeq 0.573975 $$
Another related sum is
$$s_2(x) = \sum_{k=1}^\infty \frac{\sin(k x)}{k^2}= \frac{1}{2 i} \left( \text{Li}_2\left(e^{i x}\right)-\text{Li}_2\left(e^{-i x}\right)\right)=\Im (\text{Li}_2\left(e^{i x}\right))$$
Here $\text{Li}_2\left(z\right)$ is the polylog function of second order.
Although I could not prove it from the sums it seems that $s(x) \le s_2(x)$ by a broad margin.
Finding the exact expression for the sum
We can reduce $s(x)$ to simpler sums by observing that we can write
$$\sin(x) = \frac{1}{2 i} (e^{i x} - e^{-i x})$$
$$\frac{1}{1+k^2} = \frac{1}{2} \left(\frac{1}{1+ i k}+\frac{1}{1-i k} \right)$$
Hence defining the sums
$$s_2(y,z) = \sum_{k=1}^{\infty} \frac{z^k}{1+ y k}$$
$$s_1(z) = \sum_{k=1}^\infty \frac{z^k}{1+k^2}$$
we have the identities
$$s_1(z) = \frac{1}{2}(s_2(i,z)+s_2(-i,z))$$
and
$$s(x) = \frac{1}{2 i}(s_1\left(e^{i x})-s_1(e^{- i x})\right)$$
Hence we only need to calculate $s_2$ to find $s$ by simple replacements.
There are several ways to deal with $s_2$. For example we could try to directly identify the series or, what we adopt here, replace the denominator by means of the formula
$$\frac{1}{1+ y k} = \int_{0}^{1} t^{k y} \,  dt $$
Then we have
$$s_2(y,z) =\sum_{k=1}^{\infty} \frac{z^k}{1+ y k}=\sum_{k=1}^{\infty} z^k \int_{0}^{1} t^{k y}\, dt 
\\ =\int_{0}^{1}\sum_{k=1}^{\infty} z^k t^{k y} \, dt =\int_{0}^{1}\frac{z t^y}{1-z t^y} \, dt 
\\ \overset {t^y\to u}=\frac{z}{y} \int_{0}^{1} \frac{u^{\frac{1}{y}}}{1- u z}\, du  $$
The final integral can be identified by the formula of Euler for the hypergeometric function (see https://en.wikipedia.org/wiki/Hypergeometric_function Euler type)
$$\int_0^1 u^{b-1} (1-u)^{c-b-1}(1-u z)^{-a} \, du \\ =\frac{\Gamma (b) \Gamma (c-b)}{\Gamma (c)} \,_2F_1(a,b;c;z)$$
Comparision leads to $$a\to 1, b\to 1+\frac{1}{y}, c\to b+1=2+\frac{1}{y}$$
Hence $$\frac{\Gamma (b) \Gamma (c-b)}{\Gamma (c)}= \frac{\Gamma (b) }{\Gamma (b+1)}=\frac{1}{b} \to \frac{1}{1+\frac{1}{y}} $$
and we have
$$s_2(y,z) =f_2(y,z)= \frac{z}{1+y}\, _2F_1(1,1+\frac{1}{y};2+\frac{1}{y};z)$$
Here and in what follows we denote the closed form of a sum $s_j$ by $f_j$.
Now we get
$$f_1(z) =  \frac{1}{2}(f_2(i,z)+f_2(-i,z))$$
and
$$f(x) = \frac{1}{2 i}(f_1\left(e^{i x})-f_1(e^{- i x})\right)$$
And we arrive finally at the symmetric expression
$$f(x) = \left(\frac{1}{8}+\frac{i}{8}\right) e^{-i x} \, _2F_1\left(1,1-i;2-i;e^{-i x}\right)\\-\left(\frac{1}{8}+\frac{i}{8}\right) e^{i x} \, _2F_1\left(1,1-i;2-i;e^{i x}\right)\\-\left(\frac{1}{8}-\frac{i}{8}\right) e^{-i x} \, _2F_1\left(1,1+i;2+i;e^{-i x}\right)\\+\left(\frac{1}{8}-\frac{i}{8}\right) e^{i x} \, _2F_1\left(1,1+i;2+i;e^{i x}\right)$$
Done.
A: Strating from @user1337's answer, what is interesting is that for small values of $x$, we can write
$$f(\infty,x)=\sum_{n=0}^\infty \frac{a_n-\Big[\frac{H_{i}+H_{-i}}{2} +\log(x)\Big]}{(2n+1)!} x^{2n+1}$$
where the  $a_n$'s are
$$\left\{1,\frac{23}{12},\frac{19}{8},\frac{1355}{504},\frac{14761}{5040},\frac{34675}{11088},\frac{20381}{6160},\cdots\right\}$$
A: The limit can be expressed via hypergeometric functions as:
$$\lim_{n \to \infty} f(n,x) = \\\left(\frac{1}{8}+\frac{i}{8}\right) e^{-i x} \left(\, _2F_1\left(1,1-i;2-i;e^{-i x}\right)+i \, _2F_1\left(1,1+i;2+i;e^{-i x}\right)-e^{2 i x} \left(\, _2F_1\left(1,1-i;2-i;e^{i x}\right)+i \, _2F_1\left(1,1+i;2+i;e^{i x}\right)\right)\right).$$
