Here is the sort of thing that is not immediately visible in the quadratic field viewpoint. Suppose we have target $n,$ say $\gcd(n,4d) = 1$ and suppose we are able to solve
$$ u^2 \equiv 4 d \pmod {4n}, $$
$$ u^2 = 4d + 4 n t. $$ Then
$$ u^2 - 4 n t = 4 d. $$ Thus we have constructed a quadratic form
$$ \langle n,u,t \rangle $$
of discriminant $4d.$ I meant to guarantee that the form was primitive. By the reduction scheme of Gauss and Lagrange, this form reduces over $SL_2 \mathbb Z$ to some "reduced" form $ \langle a,b,c \rangle $ of the same discriminant, where reduced is equivalent to $ac <0, b > |a+c|.$ This need not be the principal form, and if $n$ is prime there is just one possible form and its "opposite" that represent $n.$
Here is a good one: we can represent $x^2 - 229 y^2 = p$ (for $p \neq 2,3, 229$) if and only if $z^3 - 4 z - 1 $ factors into three distinct factors $\pmod p.$ This is from an Henri Cohen book, appendix. The form class group, reduced, are
916 factored 2^2 * 229
1. 1 30 -4 cycle length 10
2. 3 28 -11 cycle length 18
3. 11 28 -3 cycle length 18
form class number is 3
=====================================================================
Small positive primes x^2 - 229 y^2 :
37 53 173 193 229 241 347 359 383 439
443 449 461 503 509 541 593 607 617 619
643 691 907 967 977
parisize = 4000000, primelimit = 500509
? factormod( z^3 - 4 * z - 1, 37)
%1 =
[Mod(1, 37)*z + Mod(8, 37) 1]
[Mod(1, 37)*z + Mod(13, 37) 1]
[Mod(1, 37)*z + Mod(16, 37) 1]
? factormod( z^3 - 4 * z - 1, 53)
%2 =
[Mod(1, 53)*z + Mod(5, 53) 1]
[Mod(1, 53)*z + Mod(19, 53) 1]
[Mod(1, 53)*z + Mod(29, 53) 1]
? factormod( z^3 - 4 * z - 1, 173)
%3 =
[Mod(1, 173)*z + Mod(26, 173) 1]
[Mod(1, 173)*z + Mod(156, 173) 1]
[Mod(1, 173)*z + Mod(164, 173) 1]
?
============================================
Monday, 19 Feb.: now i remember why I stuck with positive binary forms for my inhomogeneous examples; I just ran $$3 x^2 + 13 x y - 5 y^2 + z^3 - 4 z \neq \pm 1$$ which is very nice. However, in order to have the discriminant of $z^3 - 4 z + r$ to be a square multiple of that for $r=1,$ we get $27 r^2 + 229 w^2 = 256,$ so we get no more. Compare https://mathoverflow.net/questions/12486/integers-not-represented-by-2-x2-x-y-3-y2-z3-z and Kevin Buzzard's answer. The collection of related material, as pdfs, is now at ZAKUSKI INHOM
Probably enough. I like Buell, Binary Quadratic Forms. Similar in Dickson, Introduction to the Theory of Numbers (1929). Comparison of definitions of "reduced" is in Franz Lemmermeyer's 2010 book, page 37 (pdf 43) Theorem 1.36.
For actually finding all representations of some $n$ of intermediate size by an indefinite form, i like Conway's topograph method. It displays both the action of the (oriented) automorphism group of the form and the finite set of representations that are distinct under the group action. Here is one with pretty good illustrations, I found that drawing by hand on paper works best by drawing the "river" on one page (if it will fit) but then draw "trees" leaving the riverside to show the targets http://math.stackexchange.com/questions/739752/how-to-solve-binary-form-ax2bxycy2-m-for-integer-and-rational-x-y/739765#739765
http://www.maths.ed.ac.uk/~aar/papers/conwaysens.pdf and
https://www.math.cornell.edu/~hatcher/TN/TNbook.pdf and
http://www.springer.com/us/book/9780387955872
http://bookstore.ams.org/mbk-105/
Let me paraphrase your question as follows:
Determine all $z\in\Bbb{Z}$ for which there exist $d,x,y\in\Bbb{Z}$ with $|d|,|y|>1$ and $d$ squarefree such that
$$x^2+dy^2=z.\tag{1}$$
First note that for $z=0$ there are no integral solutions with $d$ squarefree.
If $z\neq0$ then for every integer $x$ we have the trivial solution
$$(d,x,y)=(z-x^2,x^2,1),$$
which of course fails to meet the condition that $|y|>1$. But for sufficiently large values of $x$ we get
$$d=z-x^2<-1,$$
and so $\Bbb{Z}[\sqrt{-d}]$ is a real quadratic ring. By Dirichlet's unit theorem its unit group has rank $1$, so if $u+v\sqrt{-d}\in\Bbb{Z}[\sqrt{-d}]$ is a fundamental unit and $n\in\Bbb{Z}$ is any integer we have
$$N\left((x+y\sqrt{-d})(u+v\sqrt{-d})^n\right)=N(x+y\sqrt{-d})N(u+v\sqrt{-d})^n=z,$$
yielding infinitely many integral solutions to $(1)$: If $a_n,b_n\in\Bbb{Z}$ are such that
$$a_n+b_n\sqrt{-d}=(x+y\sqrt{-d})(u+v\sqrt{-d})^n,$$
then the above shows that indeed
$$a_n^2+db_n^2=z.$$
Moreover, this yields infinitely many integral solutions $(d,x,y)=(d,a_n,b_n)$ with $|y|>1$, because if $b_m=b_n$ then it quickly follows that $m=n$.
All that remains to be shown is that we can choose $x$ sufficiently large such that $d=z-x^2$ is squarefree.
Best Answer
If $n$ is not a power of $2$ then $n=2^k(2m+1) \space k \ge 0, m > 0$ so $n=2^k(m+1)^2 - 2^km^2$.
If $n$ is a power of $4$ then $n = 2^{2k} = (2^{k+1})^2 - 3(2^k)^2$.
If $n$ is a power of $2$ but not a power of $4$ then $n=2^{2k+1} = (2^{k+1})^2 - 2(2^k)^2$.