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