We prove quantitative equidistribution results for nilflows on compact three-dimensional homogeneous nilmanifolds by a method based on renormalization and invariant distributions for nilflows. As an application we obtain a dynamical proof of quantitative equidistribution results for the sequence P(n) (mod 1), where $P(X)\in \mathbb{R}[X]$ is a quadratic polynomial with generic leading coefficient. Bounds on theta sums, that is, Birkhoff sums of the exponential function along such sequences, were proved by Hardy and Littlewood and in optimal form by Fiedler, Jurkat and Körner.