Without loss of generality we can assume $x,y\in \mathbb{N}\ (?)$.
$$n^2+2=\dfrac{x^2}{y^2} \implies x^2=y^2\left(n^2+2\right)$$
For odd or even $n$, $x,y$ can be both odd, or exactly one of them should be even.
Case 1 ($n$ odd)
Case 1.1 (both odd)
$\left(x^2\equiv1\pmod4, y^2\equiv1\pmod4\right)\land \left(x^2=y^2\left(n^2+2\right)\right) \implies 1\equiv3\pmod 4$
Case 1.2 ($x$ odd, $y$ even)
$\left(x^2\equiv1\pmod4, y^2\equiv0\pmod4\right)\land \left(x^2=y^2\left(n^2+2\right)\right) \implies 1\equiv0\pmod 4$
Case 1.3 ($x$ even, $y$ odd)
$\left(x^2\equiv0\pmod4, y^2\equiv1\pmod4\right)\land \left(x^2=y^2\left(n^2+2\right)\right) \implies 0\equiv3\pmod 4$
Case 2 ($n$ even)
Case 2.1 (both odd)
$\left(x^2\equiv1\pmod4, y^2\equiv1\pmod4\right)\land \left(x^2=y^2\left(n^2+2\right)\right) \implies 1\equiv2\pmod 4$
Case 2.2 ($x$ odd, $y$ even)
$\left(x^2\equiv1\pmod4, y^2\equiv0\pmod4\right)\land \left(x^2=y^2\left(n^2+2\right)\right) \implies 1\equiv0\pmod 4$
Case 2.3 ($x$ even, $y$ odd)
$\left(x^2\equiv0\pmod4, y^2\equiv1\pmod4\right)\land \left(x^2=y^2\left(n^2+2\right)\right) \implies 0\equiv2\pmod 4$