Does it matter when we measure the spin of the other entangled particle? Let's say, we have 2 entangled particles: A and B which are a light-year away from each other.
We know if we measure the spin of particle A, we can be certain the spin of particle B will be in the opposite direction.
My question is: does it matter "when" we measure the spin of particle B?
E.g., if we measure the spin of particle A on the 27th of November 2022 at 14:15, and let's say the spin is UP, can we always be certain that if we measure the spin of particle B, let's say millions of years in the future, its spin will always be DOWN? Or must the measurement of particle B also be at the exact same time as A for us to be certain of its spin to be DOWN?
 A: No, it doesn't matter.
Say you have the entangled state:
\begin{equation}
|\psi_0\rangle=\frac{1}{\sqrt{2}}\left(|\uparrow\rangle_A|\downarrow\rangle_B + |\downarrow\rangle_A|\uparrow\rangle_B \right)
\end{equation}
If A makes a measurement and finds, say, spin up, then the state $|\psi_0\rangle$ collapses into:
\begin{equation}
|\psi_0\rangle\longrightarrow|\psi\rangle=|\uparrow\rangle_A|\downarrow\rangle_B 
\end{equation}
So it doesn't matter when particle B is measured, because the state is what it is.
This is assuming there's nothing that acts externally to change the state $|\uparrow\rangle_A|\downarrow\rangle_B$ in time. If that was the case, then yes it would matter, but only because the state would be evolving in time.
A: It does not matter, no. A good example is the Bell state of two qubits, $$\left| \text{Bell} \right\rangle = \left( \left| 00 \right\rangle + \left| 11 \right\rangle \right)/\sqrt{2} \, ,$$
in QI notation where $Z \left| 0 \right\rangle =  \left| 0 \right\rangle$ and $Z  \left| 1 \right\rangle = -  \left| 1 \right\rangle$.
Suppose we prepare this state and send one qubit to Alice and the other to Bob, who may be arbitrarily far apart. The way I think about measurements is described here in the case of qubits. This method follows from Stinespring dilation (see also Figure 1 of this work for a nice picture). Intuitively, it's the many-worlds picture of measurement.
When a quantum system is measured, the system becomes entangled with the measurement apparatus in a particular way. Let's imagine measuring some operator $A$ on a qubit, where $A$ has two eigenvalues, $a^{\,}_{\pm}$. Then we can write this observable as
$$ A \, = \, \sum\limits_{\pm} \, a^{\,}_{\pm} \, \mathbb{P}^{\,}_{\pm} \, , $$
where $\mathbb{P}^{\,}_{\pm}$ projects onto the eigenstates of $A$ with eigenvalues $a^{\,}_{\pm}$ (i.e., $A \, \mathbb{P}^{\,}_{\pm} = a^{\,}_{\pm}\, \mathbb{P}^{\,}_{\pm}$).
If the qubit is initially in the state $\left| \psi \right\rangle$, after measuring $A$, the state becomes
$$ \left| \psi \right\rangle \, \to \, \sum\limits_{\pm} \, \left( \mathbb{P}^{\,}_{\pm} \,\left| \psi \right\rangle \right)^{\,}_{\rm ph} \otimes \left| \pm \right\rangle^{\,}_{\rm out} \, , $$
where the state $\left| \pm \right\rangle^{\,}_{\rm out}$ is the post-measurement state of the measurement apparatus, and encodes the measurement outcome (btw, the $\pm$ states are orthonormal). Also note that $\mathbb{P}^{\,}_{\pm} \,\left| \psi \right\rangle$ is simply the unnormalized collapsed wavefunction for the physical qubit given that outcome $\pm$ was observed. However, in this picture, the expression above is already normalized, and no collapse is needed! All outcomes occur.
Basically, measurement entangles the apparatus / observer with the system along a particular outcome. Now, suppose Alice measures $Z$ on her qubit. The Bell state is updated according to
$$\left| \text{Bell} \right\rangle \to \left( \left| 00 \right\rangle \otimes \left| 0 \right\rangle^{\,}_A + \left| 11 \right\rangle \otimes \left| 1 \right\rangle^{\,}_A\right)/\sqrt{2} \, ,$$
where the $A$ subscript denotes the qubit that encodes the outcome of Alice's measurement. If Bob then measures, the state becomes
$$\left| \text{Bell} \right\rangle \to \left( \left| 00 \right\rangle \otimes \left| 0 \right\rangle^{\,}_A \otimes \left| 0 \right\rangle^{\,}_B + \left| 11 \right\rangle \otimes \left| 1 \right\rangle^{\,}_A \otimes \left| 1 \right\rangle^{\,}_B \right)/\sqrt{2} \, ,$$
where the $B$ state labels Bob's outcome.
Importantly, nothing drastic happened to the physical state of the two qubits. And performing these operations in either order (or simultaneously) gives the same result. This is most clear from noticing that everything is invariant under relabelling $A \leftrightarrow B$. Not that you asked, but (1) there is n=no collapse required, (2) nothing nonlocal happens (the measurement locally couples the measured qubit with the nearby measurement apparatus), and (3) no information is sent upon measurement.
Even if Bob knows he shares this particular Bell state with Alice, there is no operation he can perform on his qubit to tell if she measured, what she measured, or her outcome. If he also knows she intends to measure $Z$, there's still nothing he can do to tell whether she measured yet. The reason is physical: The order of measurements does not matter. No information is transferred by a quantum measurement alone.
As an aside, suppose that Bob intends to measure $X$ instead. If we write the same Bell state in the $Z$ basis for Alice and the $X$ basis for Bob, it is instead
$$\left| \text{Bell} \right\rangle = \frac{1}{2}  \left( \left| 00 \right\rangle +  \left| 01 \right\rangle  +\left| 10 \right\rangle -  \left| 11 \right\rangle \right) \, ,$$
where the two numbers refer to different operator bases (this is fine as long as we remember that). However, because the state is written in the measurement basis, the same thing happens as in the case of the $Z$ measurements. After both measurements are made (in either order), the state becomes
$$\left| \text{Bell} \right\rangle \to \frac{1}{2} \left( \left| 00,00 \right\rangle +  \left| 01,01 \right\rangle + \left| 10,10 \right\rangle -  \left| 11,11 \right\rangle \right) \, ,$$
where the digits before the commas in each ket give the physical states of both qubits (in the $Z$ and $X$ basis for Alice and Bob, respectively), and the digits after the commas are the recorded outcomes (in the same bases). Again, the measurement devices are simply entangled with their respective qubits in the measurement basis. Nothing drastic happens, no information can be extracted, and the order of measurements is unimportant.
