To factor $ 3a^{3}+3a^{2}+a+1 $ we can use factoring by grouping:
Group $ \color{blue}{ 3x^{3} }$ with $ \color{blue}{ 3x^{2} }$ and $ \color{red}{ x }$ with $ \color{red}{ 1 }$ then factor each group.
$$ \begin{aligned} 3a^{3}+3a^{2}+a+1 = ( \color{blue}{ 3x^{3}+3x^{2} } ) + ( \color{red}{ x+1 }) &= \\ &= \color{blue}{ 3x^{2}( x+1 )} + \color{red}{ 1( x+1 ) } = \\ &= (3x^{2}+1)(x+1) \end{aligned} $$