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