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