I think the easiest description is the following:
The inclusion of the basepoint of a CW complex is a cofibration, meaning if I have a basepointed map between CW complexes $f:X \rightarrow Y$, given a path $\gamma$ in $Y$ starting at the basepoint, I can extend this path to a homotopy $X \times I \rightarrow Y$ that has its 0-slice $f$. If $\gamma$ is a loop, you can define an action of $\gamma$ on $[X,Y]_*$ by taking $f$ to the 1-slice of the homotopy .
To read more about this and see that it is well defined, read Hatcher's section 4.A.
Now I assume $n>2$, I assume you can do it in the lower cases.
To do this calculation, simply lift the homotopy to $S^{n-1}$ as it is the universal cover, you can see that the effect of this equivalence relation is identifying a map into $S^{n-1}$ with its antipode, so if $n-1$ is even you are quotienting out by the action of postcomposition by a $-1$ degree map, and if $n-1$ is odd you are doing nothing.
Note, postcomposing by $-1$ is not the same as taking the negative. This is only true after suspending. An example, the Hopf fibration is homotopic to itself postcomposed by $-1$, but it is not order 2. However, its suspension is order 2. I'm not sure what is known in general about this postcomposition.
However, for the case of $[S^n, \mathbb{R}P^{n-1}]$ we can explicitly deal with this. If $n>3$ the nth homotopy group of $S^{n-1}$ has stabilized to $\mathbb{Z}/2$, so we can indeed say that postcomposition by a degree -1 map is negation (which is the identity). So $[S^n,\mathbb{R}P^{n-1}]=\mathbb{Z}/2$ if $n>3$. If $n=3$, then we have $\pi_3(S^2)$ generated by the Hopf fibration which I mentioned is not affected by the postcomposition, so $[S^n,\mathbb{R}P^{n-1}]=\mathbb{Z}$.
So it is actually the case that the unbased maps are the same as the based maps for this specific choice of sphere and projective space, but it won't be true in general.