Suppose you have three $x$-values: $-1,0, +1.$
The corresponding dependent variables $Y_1,Y_2,Y_3$ are where the randomness is.
Now draw the picture. You can see why, if you move $Y_2$ up or down, the fitted line moves up or down. (By just $1/3$ as much as $Y_2$ moves.) But what happens if you move $Y_3$ up or down? The fitted line doesn't just move up or down; its slope also gets bigger or smaller. Or if you move $Y_1$ up or down, then the slope gets smaller or bigger, respectively. So the line has more tendency to stay close to the data point when the data point's $x$-value is far from the average $x$-value than when it is near the average $x$-value. Hence the observed residuals have a smaller variance when the $x$-value is far from the average $x$-value than when the $x$-value is close to the average $x$-value.
The fitted values are
\begin{align}
& \left(\widehat Y_1, \widehat Y_2, \widehat Y_3\right) \\[5pt]
= {} & \left( \tfrac 2 3 Y_1+ \tfrac 1 3 Y_2, \,\,\, \tfrac 1 3 (Y_1+Y_2 + Y_3), \,\,\, \tfrac 1 3 Y_2 + \tfrac 2 3 Y_3 \right).
\end{align}
So the residuals are
\begin{align}
& \left( Y_1, Y_2, Y_3 \right) - \left(\widehat Y_1, \widehat Y_2, \widehat Y_3\right) \\[5pt]
= {} & \left( \tfrac 1 3 Y_1 - \tfrac 1 3 Y_2, \,\,\, -\tfrac 2 3 Y_1+ \tfrac 2 3 Y_2 - \tfrac 2 3 Y_3, \,\,\, -\tfrac 1 3 Y_2 + \tfrac 1 3 Y_3 \right).
\end{align}
From this one can compute the variances of the residuals.
[Specific formulas are readily derived or may be found in other answers on site.]
– Glen_b Apr 18 '19 at 03:18