From a modern theta-function identity of G. E. Andrews we derive new representations for the celebrated Madelung constant and various of its analytic relatives. The method leads to connections with the modern theory of multiple zeta sums, generates an apparently entire "$\eta$ series" representation, and, for the Madelung constant in particular, yields a finite-integral representation. These analyses suggest variants of the Andrews identity, leading in turn to number-theoretical results concerning sums of three squares.