$1.$ Derive $e_x, e_{x:\bar n}$ directly, if $X \sim U(0, w)$ with $x = 20, n = 30, w = 100$.
$2$. Derive $e_x, e_{x:\bar n}$ directly, if $X \sim \operatorname{Exp}(\lambda)$ $(E(x) = \lambda = 80)$ with $x = 20$ and $n = 30$.
I have an idea on how to solve this but I am not sure if it is the right approach. For $1)$, we know that $tpx= 1-\frac{t}{80}$
In order to find ex I could use the sum from $k=1$ to $100-x(tpx)$.
This would give me $100-x-\frac{(100-x)(-x+101)}{160}$.
I am not sure if this right, any help would be greatly appreciated.
You're misunderstanding some basic concepts here. $x = 20$ represents a life aged $20$, and you are asked for the expected curtate future lifetime of this life. In other words, you are interested in the average additional whole number of years lived by this life. That is the meaning of the symbol $e_x = e_{20}$. If the symbol had been $\overset{\circ}{e}_{20}$, this is the expected complete future lifetime of $(20)$.
Next, the symbol $\require{enclose}e_{x:\enclose{actuarial}{n}}$ represents the expected curtate future lifetime of $(x)$ within the next $n$ years. In other words, if $(x)$ survives less more than $n$ years, the $n$-year curtate future lifetime is $n$.
With these concepts in mind, we have $$e_x = \operatorname{E}[K_x] = \sum_{k=1}^\infty k \Pr[K_x = k],$$ where $K_x$ is the curtate future lifetime random variable for a life aged $x$. Because $K_x$ is a random variable with nonnegative support, we can also write this as $$e_x = \sum_{k=1}^\infty \Pr[K_x \ge k] = \sum_{k=1}^\infty {}_k p_x.$$ In a similar fashion, we have $$\require{enclose}e_{x:\enclose{actuarial}{n}} = \operatorname{E}[K_x \wedge n] = \sum_{k=1}^\infty \min(k, n) \Pr[K_x = k] = \sum_{k=1}^n k \Pr[X_k = k] + \sum_{k=n+1}^\infty n \Pr[X_k = k].$$ We can also write this as $$\require{enclose}e_{x:\enclose{actuarial}{n}} = \sum_{k=1}^n {}_k p_x.$$ Note the change in the upper index of summation.
I will illustrate the solution for the second question, in which the future lifetime random variable for a life at birth (age $0$) is exponential with mean $\lambda$. Thus, given survival to age $x$, the complete future lifetime random variable $T_x$ is also exponential with mean $\lambda$, due to the memorylessness property: $$\Pr[T_x > t] = \frac{\Pr[T_0 > t+x]}{\Pr[T_0 > x]} = \frac{e^{-(t+x)/\lambda}}{e^{-x/\lambda}} = e^{-t/\lambda}, \quad t > 0.$$
Therefore, the curtate future lifetime random variable $K_x$ of $(x)$ is $$\Pr[K_x = k] = \Pr[k \le T_x < k+1] = (1 - e^{-(k+1)/\lambda}) - (1 - e^{-k/\lambda}) = e^{-k/\lambda}(1 - e^{-1/\lambda}).$$ This happens to be a geometric random variable with $1$-year survival probability $e^{-1/\lambda}$.
Then $${}_k p_{20} = \Pr[K_{20} \ge k] = \sum_{j=k}^\infty \Pr[K_{20} = j] = e^{-k/\lambda} = e^{-k/80},$$ and $$e_{20} = \sum_{k=1}^\infty {}_k p_{20} = \sum_{k=1}^\infty e^{-k/80} = \frac{1}{e^{1/80} - 1}.$$
We also have $$\require{enclose}e_{20:\enclose{actuarial}{30}} = \sum_{k=1}^{30} {}_k p_{20} = \sum_{k=1}^{30} e^{-k/80} = \frac{1-e^{-30/80}}{e^{1/80} - 1} \approx 24.8608.$$
Now that I have illustrated the solution for this part of your question, I leave the uniform case to you. If you have any further questions, please let me know.