Spin is a funky quantum version of angular momentum that comes in units of $\hbar.$ There are two ways that you can space things by $\hbar$: you can either have integer spin, $\{\dots,-2\hbar, -\hbar, 0, \hbar, 2\hbar, \dots\},$ or you can have half-integer spin, $\{\dots,-\frac32\hbar, -\frac12\hbar, \frac12\hbar, \frac32\hbar,\dots\}.$
These amounts are components of angular momentum along an arbitrary axis. Let me give you a quick quantum-angular-momentum refresher. So we choose this arbitrary $z$-axis and measure $L_z = \hbar m$ for either integer or half-integer $m$, and then we are uncertain about $L_x$ and $L_y$ by the uncertainty principle. However it turns out that the total-angular-momentum operator $L^2 = L_x^2 + L_y^2 + L_z^2$ commutes with $L_z$ and therefore we don't have an uncertainty relation there, we can simultaneously know both $L^2 = \hbar^2 \ell (\ell + 1)$ and $L_z = \hbar ~m.$ This bounds $|m| \lt \ell.$ Both $m$ and $\ell$ will either be integers or half-integers together, if I recall correctly.
Now for quarks, and protons and neutrons are both made up of three quarks and similarly have spin-1/2, meaning $\ell = 1/2.$ This has a nice interpretation which turns out to be wrong: if you're thinking that it's as easy as "two quarks spin one way and the other spins the other way" it turns out that's overly simplistic and this is an open mystery.
If there is an even amount of half-integer spin total, either from (even number of protons + even number of neutrons) or from (odd number of protons + odd number of neutrons), then the nucleus has an even number of half-integer spins and has an integer spin in general. The argument is really simple, just line up all of the spins so that they all point up, you find that if there are N neutrons and P protons then there is a total spin in the z-direction of (N + P)/2, which is an integer. "But they are not all spinning up!" you object. Well that's fine, start flipping some of them down: each time they will go from $+\hbar/2$ to $-\hbar/2$ and they will therefore reduce the spin in the $z$ direction by $\hbar$, changing the integer by another integer. So you don't need to worry about anything else, every configuration has an integer spin upwards.
You express a worry that this spin component cannot be 0 but in many cases it is, even when you have an odd + odd combination. For example, check out the isotopes of cobalt, atomic number 27. Cobalt is kinda funky and therefore has some awesome MRI uses; its natural form is all 59Co and it has nucelar spin 7/2 in its most common case. But it also has an isotope of 54Co which we can confidently say would have spin-zero. It's odd + odd and all the spins should pair up oppositely.
Similarly if $N+P$ is odd then you have a half-integer spin up when they're all spinning up, and as you make some of them spin down they change the spin by a full $\hbar$ and therefore you map half-integers to half-integers still. So again, there is no change. And indeed as you're surmising, the spins are simply unpaired to create a net spin one way or the other.
Now as @rob says the nucleus also has internal angular momentum due to the nuclear shells, so it may be a little more complicated in general to work out the total angular momentum of the nucleus. However I noticed that you are specifically asking about the spin angular momentum and this is a plausible way to describe it. Furthermore the nuclear shells force certain spins to be paired, otherwise a nucleon would have to "jump" to the next shell which requires a ton of energy.