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