Considering the negative Pell equation $ x^2 - Dy^2 = -1 $, I know that a necessary condition for solvability is that $ D = a^2 + b^2$, with $ a,b $ positive integers.
If I fix $ b = 1 $, NPE is solvable for whatever positive integer value of $ a$;
If I fix $b = 2$, NPE is solvable for $a$ being an odd integer;
If I fix $b = 3$, NPE is solvable for $ a =$ $ \{1, 2, 7, 8, 10, 11, 16, 17, 19, 20, 22, ...\} $, so it seems the is no pattern; same thing if fix $ b = 4$, then $ a =$ $ \{1, 5, 7, 9, 11, 13, 15, 21, 25, 29, 31, 33, ...\} $, so no pattern again, and so on for greater values of $ b $
Do you know why is that for $ b > 2$ ? Is it possible to find a pattern in those cases?
There is a pattern, but not one you can see just by looking at the values of $a$.
Theorem. For a positive nonsquare integer $D$, the equation $x^2 - Dy^2 = -1$ has a solution in integers if and only if the continued fraction expansion of $\sqrt{D}$ has an odd period.
That theorem gives you a pattern. Maybe it's not what you wanted, but we can't expect simple answers to all simple-sounding questions.
It turns out that we can write down a simple general rule for $\sqrt{a^2+1}$ and simple rules for $\sqrt{a^2+4}$ depending on the parity of $a$, but in higher cases things get more complicated.
For $a \geq 1$, $$ \sqrt{a^2+1} = [a,2a,2a,2a,2a,\ldots] = [a, \overline{2a}], $$ which has period $1$.
For odd $a \geq 3$, $$ \sqrt{a^2+4} = [a,\overline{(a-1)/2,1,1,(a-1)/2,2a}], $$ which has period $5$, while for even $a \geq 2$, $$ \sqrt{a^2+4} = [a,\overline{a/2,2a}], $$ which has period $2$.
The periods for $\sqrt{a^2+9}$ when $a \geq 1$ (and $a \not= 4$, so $\sqrt{a^2+9}$ is irrational) look erratic: starting with $a = 1$ and skipping $a = 4$, the periods are $1, 5, 2, 4, 6, 7, 7, 2, 15, 3, 8, 6, 8, 8, 9, \ldots$, so you can see that there's not a simple rule here for even vs. odd periods.
Be thankful that there is a nice rule at all when $D = a^2+1$.
There has been recent work on densities of (squarefree) $D$ for which $x^2 - Dy^2 = -1$ is solvable: see https://arxiv.org/abs/2201.13424.