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