Suppose you're given two envelopes. Both envelopes have money in them, and you're told that one envelope has twice as much money as the other. Suppose you pick one of the envelopes. Should you switch to the other one?
Intuitively, you don't know anything about either envelope, so it'd be ridiculous to say that you should switch to the other envelope to maximize your expected money.
However, consider this argument. Let $x$ be the amount of money in the envelope you picked. If $y$ is the amount of money in the other envelope, then the expected value equals
$$E(y) = \frac{1}{2}\left(\frac{1}{2}x\right) + \frac{1}{2}\left(2x\right) = \frac{5}{4} x$$
But $5x/4 > x$, so you should switch!
The Wikipedia article says that $x$ stands for two different things, so this reasoning doesn't work. I say this is not a valid resolution.
Consider opening up the envelope that you pick, and finding $\$10$ inside. Then you can run the expected value calculation to get $$E(y) = \frac{1}{2} \cdot \$5+\frac{1}{2} \cdot \$20 = \$12.50$$
This means that if you open one of the envelopes and find $\$10$, you should switch to the other envelope. The $\$10$ doesn't stand for two different things, it literally just means $\$10$.
But you don't have to open up the envelope to run this calculation, you can just imagine what's inside, and run the calculation based on that. This is what "Let $x$ be the amount in the envelope" means. The problem with the argument is not that $x$ stands for two different things.
So what is the problem?
Previous questions on stack exchange have given the resolution that I just said I wasn't satisfied by, so please don't mark this as a duplicate. I want a different resolution, or a more satisfying explanation of why $x$ does stand for two different things.
Apparently there is still research being published about this problem - maybe it isn't so obvious?
I think there's something subtle wrong with the premise. Because there's no uniform probability distribution on $\mathbb{R}$, statements like "random real number" are not well-defined. Likewise, I think "one envelope has twice as much money as the other" assumes some probability distribution on $\mathbb{R}$, and perhaps our expected value calculation assumes that this distribution is uniform, which it cannot be ...
The assumption that is unrealistic is that there is a $\frac12$ chance that the other envelope contains twice the money. Realistically, there is an underlying distribution of values and that distribution dictates the probability that a given amount is the smaller.
1. Analysis of the Two Envelope Paradox
Let the value of a pair of envelopes (POE) be the smaller of the values of the envelopes. Let the pdf of the value of the POE be $f(a)$. That is, the probability that the value of a POE is between $a$ and $a+\mathrm{d}a$ is $f(a)\,\mathrm{d}a$.
The expected value of a randomly chosen envelope is $$ \begin{align} E &=\frac12\int f(a)\,a\,\mathrm{d}a+\frac12\int f(a)\,2a\,\mathrm{d}a\\ &=\frac32\int f(a)\,a\,\mathrm{d}a\tag{1} \end{align} $$ We will assume that this exists
2. Conditional Probabilities
The probability that the value of the POE was between $\frac a2$ and $\frac a2+\frac{\mathrm{d}a}2$ and that we chose the larger is $\frac12f\left(\frac a2\right)\frac{\mathrm{d}a}2$. The probability that the value of the POE was between $a$ and $a+\mathrm{d}a$ and that we chose the smaller is $\frac12f(a)\,\mathrm{d}a$. Thus, the probability that the value of the envelope we chose is between $a$ and $a+\mathrm{d}a$ is $\frac14\left(f\left(\frac a2\right) + 2 f(a)\right)\mathrm{d}a$. Therefore, we define $$ P(a)=\frac14\left[f\left(\frac a2\right) + 2 f(a)\right]\tag{2} $$ Furthermore, given that the value of the envelope we chose was between $a$ and $a+\mathrm{d}a$, the probability that we chose the envelope with the larger value is $$ L(a)=\frac{f\left(\frac a2\right)}{f\left(\frac a2\right)+2f(a)}\tag{3} $$ and the probability that we chose the envelope with the smaller value is $$ S(a)=\frac{2f(a)}{f\left(\frac a2\right)+2f(a)}\tag{4} $$ This is where the unrealistic assumption falls apart. Without knowledge of $f$, we cannot know the conditional probabilities $L$ and $S$; they are usually not $\frac12$ and $\frac12$.
3. Strategies
Always Switch
Suppose we switch all the time. Then our expected value is $$ \begin{align} &\int\left[L(a)\frac a2+S(a)2a\right]P(a)\,\mathrm{d}a\\ &=\frac14\int\left[f\left(\frac a2\right)\frac a2+2f(a)\,2a\right]\,\mathrm{d}a\\ &=\frac32\int f(a)\,a\,\mathrm{d}a\\[8pt] &=E\tag{5} \end{align} $$
Always Stay
Suppose we stay all the time. Then our expected value is $$ \begin{align} &\int\left[\vphantom{\int}L(a)\,a+S(a)\,a\right]P(a)\,\mathrm{d}a\\ &=\frac14\int\left[f\left(\frac a2\right)\,a+2f(a)\,a\right]\,\mathrm{d}a\\ &=\frac32\int f(a)\,a\,\mathrm{d}a\\[8pt] &=E\tag{6} \end{align} $$ Therefore, the expected value is $E$ whether we switch all the time or stay. This is comforting since intuition says that switching should not help.
Better Strategy
However, there is a strategy that does give us a better expected value. Choose any function $k:[0,\infty)\to[0,1]$ such that $k(2a)\gt k(a)$; a monotonic increasing function for example. If an envelope has value $a$, keep it with probability $k(a)$ and switch otherwise. Then the expected value is $$ \begin{align} &\int L(a)\left[k(a)a+(1-k(a))\frac a2\right]P(a)\,\mathrm{d}a\\ &+\int S(a)\left[\vphantom{\int}k(a)a+(1-k(a))2a\right]P(a)\,\mathrm{d}a\\[3pt] &=\frac14\int f\left(\frac a2\right)\left[k(a)a+(1-k(a))\frac a2\right]\,\mathrm{d}a\\ &+\frac14\int2f(a)\left[\vphantom{\int}k(a)a+(1-k(a))2a\right]\,\mathrm{d}a\\[3pt] &=\frac32\int f(a)\,a\,\mathrm{d}a +\frac12\int f(a)\left[\vphantom{\int}k(2a)-k(a)\right]a\,\mathrm{d}a\\[3pt] &=E+\frac12\int f(a)\left[\vphantom{\int}k(2a)-k(a)\right]a\,\mathrm{d}a\tag{7} \end{align} $$ which, if $k(2a)\gt k(a)$, is better than $E$. If $k(a)$ is constant, as it is in the previous strategies, the expected value is $E$.