Some of your confusion seems to be rooted in understanding how to work with the bounds of the sum effectively. Fortunately, we can calculate both of your sums rather easily by noting that
$$
\sum_{i=1}^n 1=n\tag{1}
$$
and
$$
\sum_{i=1}^n i=\frac{n(n+1)}{2}.\tag{2}
$$
The proofs for $(1)$ and $(2)$ are easy to come by; for example, see here and here, respectively.
Can you see the difference between the sums in $(1)$ and $(2)$ and your sums? In the above sums, we are summing from $i=1$ to $n$, whereas for your sums you are only summing from $i=2$ to $n-1$. Important: The only difference between the sums I listed above and the ones you are trying to compute is that your sums essentially omit the first and last terms in $(1)$ and $(2)$. That is,
$$
\sum_{i=2}^{n-1} 1 = \color{green}{\sum_{i=1}^{n} 1}-\underbrace{\color{red}{1}}_{{\substack{\text{first term of}\\\text{$\color{green}{\text{green}}$ sum}}}}-\underbrace{\color{red}{1}}_{{\substack{\text{$n$th term of}\\\text{$\color{green}{\text{green}}$ sum}}}}=\boxed{\color{green}{n}-\color{red}{2}}.
$$
Similarly, we have
$$
\sum_{i=2}^{n-1} i = \color{green}{\sum_{i=1}^{n} i}-\underbrace{\color{red}{1}}_{{\substack{\text{first term of}\\\text{$\color{green}{\text{green}}$ sum}}}}-\underbrace{\color{red}{n}}_{{\substack{\text{$n$th term of}\\\text{$\color{green}{\text{green}}$ sum}}}}=\color{green}{\frac{n(n+1)}{2}}-\color{red}{1}-\color{red}{n}=\boxed{\dfrac{\color{green}{n(n+1)}-\color{red}{2}-\color{red}{2n}}{\color{green}{2}}},
$$
where you can simplify the last part further if you simply expand everything. Thus, we get that
$$
\large\color{blue}{\sum_{i=2}^{n-1}1=n-2}
$$
and
$$
\large\color{blue}{\sum_{i=2}^{n-1}i=\frac{n^2-n-2}{2}}.
$$