# Number of representations of an integer by a quadratic form

I've been interested in how values of the Dedekind Eta function can be determined, and the question of finding the number of integer solutions to the equation $$n=ax^{2}+bxy+cy^{2}$$ comes up. And apparently for a special group of numbers (I believe it holds for all Heegner numbers besides 1 and 2, eg 3, 7, 11, 19, 43, 67, 163), there's an explicit formula for the number of integer solutions for a related form, $$n=x^{2}-xy+\frac{d+1}{4}y^{2}$$ Which is $$r_{d}(n)=r_{d}(1)\sum_{k\mid n}(\frac{k}{d})$$ where$$(\frac{k}{d})$$ is the Legendre symbol and $$r_{d}(n)$$ is the number of representations n has by two integer x and y values in the equation above. (the above info by http://www.math.ucla.edu/~wdduke/preprints/kronecker.pdf page 3) Now my question is, how is the formula for the representation number equation above derived? I don't know where to start with this, the part that really puzzles me is the constant in front of the sum. If anyone has any resources or knowledge of a proof it would be much appreciated.