In this example we are multiplying two binomials so FOIL method can be used.
$$ \begin{aligned} \left( \color{blue}{ w-1}\right) \cdot \left( \color{orangered}{ w+1}\right) &= \underbrace{ \color{blue}{w} \cdot \color{orangered}{w} }_{\text{FIRST}} + \underbrace{ \color{blue}{w} \cdot \color{orangered}{1} }_{\text{OUTER}} + \underbrace{ \left( \color{blue}{-1} \right) \cdot \color{orangered}{w} }_{\text{INNER}} + \underbrace{ \left( \color{blue}{-1} \right) \cdot \color{orangered}{1} }_{\text{LAST}} = \\ &= w^2 + w + \left( -w\right) + \left( -1\right) = \\ &= w^2 + w + \left( -w\right) + \left( -1\right) = \\ &= w^2-1; \end{aligned} $$