\(x\left(y+z\right)^2+y\left(x+z\right)^2+z\left(x+y\right)^2-4xyz\)
\(=x\left(y^2+2yz+z^2\right)+y\left(x^2+2xz+z^2\right)+z\left(x+y\right)^2-4xyz\)
\(=xy^2+2xyz+xz^2+x^2y+2xyz+yz^2+z\left(x+y\right)\left(x+y\right)-4xyz\)
\(=\left(xy^2+x^2y\right)+\left(xz^2+yz^2\right)+z\left(x+y\right)^2\)
\(=xy\left(x+y\right)+z^2\left(x+y\right)+\left(xz+yz\right)\left(x+y\right)\)
\(=\left(x+y\right)\left(z^2+xz+yz+xy\right)\)
\(=\left(x+y\right)\left[z\left(x+z\right)+y\left(x+z\right)\right]\)
\(=\left(x+y\right)\left(y+z\right)\left(x+z\right)\)