I am to compute the following sum and my professor wrote this on the board. Although I can see what he is doing here and how to use the S and 2S I can't figure out the steps that are highlighted in yellow. Like, where did the (n-2)2^(n-1) come from? Also, how is it that 2(n-1)2^(n-1) is equivalent to (n-1)2^n?

You ask:
Also, how is it that 2(n-1)2^(n-1) is equivalent to (n-1)2^n?this is just $2\cdot (n-1)\cdot 2^{n-1}$
Because multiplication is commutative, you can change the order to
$(n-1)\cdot 2\cdot 2^{n-1}$
Then combine the 2's giving you
$(n-1)\cdot 2^{n}$
where did the (n-2)2^(n-1) come from?In that line where he's simplifying 2S, he's multiplying the 2 into the power of 2 in each term. so Instead of thinking of $6\cdot 2^3$ he's thinking $2\cdot 3\cdot 2^3$ then using the same trick as above, moving the 2 over and incorporating it into the power of 2, so that's $3\cdot 2\cdot 2^3$ which is equal to $3\cdot 2^4$ -- following that pattern you end up with the general term looking like $n\cdot 2^{n+1}$ and the terms below that which start with $(n-2)$ and $(n-1)$ just follow that pattern with $n-2$ or $n-1$ subbed in for n in the general term.
hope that makes sense