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