# Fundamental approximation in the circle method

I am interested in the circle method and I am currently working on Vaughan's book. Let $$f$$ be the generating function $$f$$ of the squares, that is to say the power series sum of $$z^{m^2}$$.

One of the main points of the method is to approximate the generating function in the form $$f(\rho e(\frac aq + \beta) ) \sim \frac Cq S(a, q) (1-\rho e(\beta)) ^{-1/2} \qquad (\star)$$

where $$S(a, q) = \sum_m e(am^2/q)$$

where the sum is over m modulo $$q$$. This lead to decomposing the sought coefficients into singular series and singular integral, up to an error term. However, I do not understand where does $$(\star)$$ come from. It does not seem to me to be a straightforward development of the function. Also, is it dependent on the particular choice of the problem of sum of squares, or does an analogous of $$(\star)$$ also hold for every function in this context? How to get a precise error term?