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