In the context of DFT, Where Does the Nyquist Frequency Sample Belong In a Double Sided Frequency Spectrum (Positive / Negative Side)?
It's convention, they're equivalent:
$$
\exp{\left(j2 \pi \frac{N}{2}n/N \right)} 
 = \exp{\left(j2\pi \frac{-N}{2}n/N\right)} \\
\Rightarrow e^{j\pi n} = e^{-j \pi n} \Rightarrow \cos(\pi n) = \cos(-\pi n)=(-1)^n,\ j\sin(\pi n) = j\sin(-\pi n) = 0
$$
MATLAB and Numpy go $[-N/2, ..., N/2-1]$, which is unfortunate for analytic representations (+ freqs only). Note also its value is doubled relative to other bins (but not manually; they correlate this way), so in a sense it's both a negative and positive frequency, so energy's preserved:

You can tell a library's preference by fftshift docs: