Motivation for the study of Jacobi Theta Functions The wikipedia definition says:

"There are several closely related functions called Jacobi theta functions, and many different and incompatible systems of notation for them. One Jacobi theta function (named after Carl Gustav Jacob Jacobi) is a function defined for two complex variables z and τ, where z can be any complex number and τ is confined to the upper half-plane, which means it has positive imaginary part. It is given by the formula"

$$\vartheta(z; \tau) = \sum_{n=-\infty}^\infty \exp (\pi i n^2 \tau + 2 \pi i n z)= 1 + 2 \sum_{n=1}^\infty \left(e^{\pi i\tau}\right)^{n^2} \cos(2\pi n z) = \sum_{n=-\infty}^\infty q^{n^2}\eta^n"$$
This definition is perfectly fine for me, no problem. But why would somebody think of a function in this way? Is there na historical reason to study functions this way, or does these types of functions apear naturally in some field of study of mathematic?
 A: They come up for example in classical algebraic geometry. To a compact Riemann surface $S$ of genus $g$ you can associate a $g$-dimensional complex torus $J(S) = \mathbb{C}^g/\Lambda$ called the Jacobian of $S$. There is a mapping from $S$ to $J(S)$ called the Abel-Jacobi map and a lot of the geometry of $S$ can be studied from this mapping and other related objects.
The Riemann theta function associated to $S$ is a holomorphic function defined on $\mathbb{C}^g$. When the genus is one, i.e. when $S$ is itself a torus, this reduces to the Jacobi theta function and the parameter $\tau$ in the definition is the dependence on $S$ (compact Riemann surfaces can be parametrized by points on the upper half-plane).  Now, while this function is defined on $\mathbb{C}^g$, it is not defined on the Jacobian $\mathbb{C}^g/\Lambda$ because it is not fully periodic (there are no non-constant holomorphic functions on a compact complex manifold anyways). However, it is "almost-periodic" in the sense that it satisfes some functional equations like mentioned on the Wikipedia entry. In particular, the zero-set of the Riemann theta function is well defined as a subset of the quotient $\mathbb{C}^g/\Lambda$ because it has the good periods in $\mathbb{C}^g$, it is called the theta divisor. In some sense, the information contained in the data of $J(S)$ and of a theta divisor completely determines $S$ (this is Torelli's theorem). From this point of view, it is clear that theta functions contain a lot of information about geometry.
I'm sure there are a lot of other stories like that, in particular having to do with number theory. For example they can be used to count the number of ways you can represent a prime number as a sum of whole numbers squared. So yes, you are right to think that people didn't just start taking a strange, sudden interest in these functions out of the blue. They came up by themselves while people were studying different areas of mathematics, they are very mysterious!
A: I would like to add, my first run into the Jacobi theta functions was by asking out of the blue about the series $1+ x+x^4 + x^9 ... $ where the exponents are all square numbers. This is probably well known to the asker but my hope is by adding this answer here future readers can run into this, since this also a very natural reason to study them. 
Some questions can include ^ does that have a closed form? Does it have any pretty identities? And least of all for me (though most important of all for most) how does it connect to everything else? (Which @Jef808 does a good job explaining). 
