Integration and periodic divergent series Consider the divergent infinite series
$$ \sum_{n=1}^\infty 5^n \cos(nt) $$
where $t \in \mathbb{R}$.  I don't believe it has a closed form.  However, if I take the integral with respect to $t$:
$$ \int_{-\pi}^\pi \sum_{n=1}^\infty 5^n \cos(nt) \, dt = \sum_{n=1}^\infty 5^n \int_{-\pi}^\pi \cos(nt) \, dt$$
$$ = \sum_{n=1}^\infty 5^n \cdot 0 = 0$$
So even though the series is divergent it still has a finite integral.  This seems to be a consequence of the fact that it's periodic over the integration domain: the infinities sort of cancel each other out.
This can extend also to the product of series:
$$ \int_{-\pi}^\pi \left( \sum_{n=1}^\infty 5^n \cos(nt) \right) \left(\sum_{n=1}^\infty \frac 1 {7^n} \cos(nt) \right) \,dt$$
$$ = \pi \sum_{n=1}^\infty \left( \frac 5 7 \right)^n = \frac 5 2 \pi$$
I'm trying to understand the underlying properties at work here.  Specifically, is there a way to come up with a "closed form" for a periodic infinite divergent series which behaves the same under integration (for instance, something I could use with integration by parts) without actually being the limit of the partial sums of $f(t)$?  That is, something like a proxy function with the infinities sort of preemptively normalized out?
 A: You are asking about asymptotics$^\dagger$. Specifically assigning a meaning to divergent series. The strategy is to first construct something that does converge out of your series. Using Borel summation, we write
$$ \phi(x)=\sum_{n=0}^{\infty} c_n \frac{x^n}{n!}$$
Where the $c_n$ are given by your series
$$ c_n =5^n \cos(nt)$$
Now let
$$ B(x)=\int_0^\infty  dz \ \phi(xz)\exp(-z)$$
We will define your (divergent) sum as $B(1)$, if that exists. It's not obvious, but the above things are defined so that $B(1)=\sum_n c_n$, which follows after a few manipulations. In any case, with the assistance of Mathematica, I find
$$\phi(x)=\cos(5x\sin(t)) \left( \cosh(5x\cos(t))+\sinh(5x\cos(t))\right)$$
$$B(x)=\frac{1}{2}\left( 1+\frac{1}{1-5xe^{it}}+\frac{5x}{-5x+e^{it}} \right)$$
$$ B(1) = \frac{1}{2}+\frac{6}{-13+5\cos(t)}$$
This is nice, but the manipulations are obscure and the integrals annoying. Let us apply Euler summation to get the same answer with much less fuss$^\ddagger$. Let
$$ I(x)=\sum_n c_n x^n $$
With the $c_n$ given by your series.  This is more intuitive than Borel summation because it is obvious that when $x=1$, we have $\sum_n c_n$, which is your original sum. We will define $\lim_{x\rightarrow 1}I(x)$ as that sum, if the limit exists. Substituting your $c_n$
$$ I(x)=\sum_n (5x)^n \cos(nt)=\frac{1}{2} \sum_n (5x)^n \left(e^{int}+e^{-int} \right)$$
$$ I(x)=\frac{1}{2} \sum_{n=0}^\infty \left( 5xe^{it} \right)^n +\frac{1}{2} \sum_{n=0}^\infty \left( 5xe^{-it} \right)^n$$
We now have two geometric series, and importantly, they converge for $|x|<1/5$.
$$ I(x)=\frac{1}{2} \frac{1}{1-5xe^{it}}+\frac{1}{2} \frac{1}{1-5xe^{-it}}$$
Having performed the sum, we take the limit $x \rightarrow 1$ to find
$$ I(1)=\frac{1}{2}+\frac{6}{-13+5\cos(t)}$$
Which we may define as the value of your sum. As promised, $I(1)=B(1)$. Why does this (sometimes) work? Because for small enough $x$, perhaps $I(x)$ converges, even though the original sum didn't. Similar logic applies to Borel summation, with that terrific $1/n!$ damping of terms.
$\dagger$ Too large a topic to explain here. I'll just refer you to Carl Bender's excellent book: Advanced mathematical methods.
$\ddagger$ There are other types of summation, too. For a given series, some may work while others fail.
EDIT: Using a method inspired by the other answer:
For real $t$, the sum must diverge because $|\cos|\leq1$ but $5^n$ grows exponentially, so $\lim_{n\rightarrow \infty}c_n \neq0$. However, if we allow $t \in \mathbb{C}$, and writing $\cos$ in exponential form, the sums converge for $t$ with sufficiently large imaginary part. After performing the sum we can define the answer to be $\lim_{\Im(t)\rightarrow 0}$, which turns out to be exactly $B(1)$.
A: If we denote the series:
$$S_N(t)=\sum_{n=1}^N5^n\cos(nt)$$
$$s_N(t)=\sum_{n=1}^N5^n\sin(nt)$$
then we can see that:
$$S_N(t)+is_N(t)=\sum_{n=1}^N5^ne^{int}=\sum_{n=1}^N\left(5e^{it}\right)^n$$
Now we have a geometric series so we can say:
$$A_N=S_N(t)+is_N(t)=\frac{\left(5e^{it}\right)^{N+1}-1}{5e^{it}}$$
now we can try and split this up into real and imaginary parts:
$$A_N=e^{-it}\frac{(5e^{it})^{N+1}-1}{5}=(5e^{it})^N-\frac{e^{-it}}{5}$$
$$A_N=5^N\left[\cos(Nt)+i\sin(Nt)\right]-\frac15\left[\cos(t)-i\sin(t)\right]$$
and so we can deduce:
$$S_N(t)=5^N\cos(Nt)-5^{-1}\cos(t)$$
so for certain values of $t$ it is possible that $S_{N\to\infty}(t)$ converges
