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