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