In the life-long repeated struggle to understand the resolution of the two envelops problem, I finally found out the real crucial part is basically to understand why $E(X\mid X=1000)$ is not equal to $1000$, assuming you opened one of the envelop and found $500$ dollars inside.
However, intuitively how does this not be the case. I tried to find a concrete example where this equality does not hold but failed to do so. Indeed, there is no formula suggesting the equality to be true, but intuitively I am struggle to understand why this is not the case.
Edit: For more context, according to this video, $X$ is somehow dependent with $X=1000$ and somehow this makes the equation false. However I am still struggling to understand the intuition without a concrete example.
The statement $\mathbb{E}[Y | Y=1000] = 1000$ is correct, so long as the expectation is defined (i.e. it's possible that $Y=1000$.
The statement in the video, which is wrong, is different: $\mathbb{E}[Y | Y=2X] = \mathbb{E}[2X]$. The fact that we have $2X$ - another random variable - instead of $1000$ is key here.
A simple example is $X \in \{1,2\}$ with equal probability, and $Y = 3 - X$ (note, this is actually a special case of the two envelopes problem, with values 1 and 2).
Essentially, we have two cases: $X=1, Y=2$, and $X=2, Y=1$. Then $\mathbb{E}[2X] = 3$, while $\mathbb{E}[Y | Y=2X] = 2 \neq 3$, because only the first case $X=1, Y=2$ fits the condition.
We can correct the wrong statement as mentioned in the video: $\mathbb{E}[Y | Y=2X] = \mathbb{E}[2X | Y = 2X]$. In our example, $\mathbb{E}[2X | Y = 2X] = 2$ as well.
To get back to the original statement with 1000, we have: $\mathbb{E}[Y | Y = 1000] = \mathbb{E}[1000 | Y = 1000] = 1000$.
EDIT:
To clarify a bit on how that relates to the two envelopes problem, consider the full setup:
First, A chooses the pair of random variables $(X, Y)$ according to some distribution, such that $X=2Y$, or $Y=2X$. Puts $X$ in one envelope, and $Y$ in the other.
Now, B opens the first envelope and sees that $X=500$. How he knows that either $Y=250$, or $Y=1000$, and $\mathbb{E}[Y | X=500] = 250 \times \mathbb{P}[Y=250|X=500] + 1000 \times \mathbb{P}[Y=1000|X=500]$. With what we know so far we don't know the values of $\mathbb{P}[Y=250|X=500]$ and $\mathbb{P}[Y=1000|X=500]$. They depend on the distribution A used when choosing $(X, Y)$.
For example, suppose A chose a number uniformly between $0$ and $250$ for the smaller value. Then, if we open $X=500$, we know for sure that $Y=250$. Likewise, if A chose the smaller number to be uniformly between $500$ and $2000$, then if we opened $X=500$, we know for sure that $Y=1000$. And any case between these two extremes exists.
Now, in the two envelopes problem we're not told what the distribution of $(X, Y)$ is. This simply means that you can't compute $\mathbb{P}[Y=1000|X=500]$. You can't just assume it to be $\frac{1}{2}$.
Contrast these two: $\mathbb{P}[Y=2X]$ and $\mathbb{P}[Y=2X | X=500]$. The first is $\frac{1}{2}$. The second isn't, because the event $Y=2X$ is not independent of the value of $X$.