While studying sequences and series, I came across summations of geometric series. I am able to derive the sum of a geometric progression and that of arithmetico–geometric sequence.
But taking a step further, I found the following series intriguing: the $i^{th}$ term is $a^{i^2}$ (instead of $a^{i}$ as in geometric series).
Is there a name for this series? How can we evaluate its sum?
$$ S = \sum_{i=0}^{n-1}a^{i^2} $$
First, I tried multiplying $S$ by $a$ and differentiating it by $a$ but to no avail. Then, I went through the 8 PDFs listed in Gould's homepage containing enormous combinatorial identities but couldn't make any progress.