To factor $ xy+8y+3x+24 $ we can use factoring by grouping.
Group $ \color{blue}{ xy }$ with $ \color{blue}{ 8y }$ and $ \color{red}{ 3x }$ with $ \color{red}{ 24 }$ then factor each group.
$$ \begin{aligned} xy+8y+3x+24 &= ( \color{blue}{ xy+8y } ) + ( \color{red}{ 3x+24 }) = \\ &= \color{blue}{ y( x+8 )} + \color{red}{ 3( x+8 ) } = \\ &= (y+3)(x+8) \end{aligned} $$