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