\(\dfrac{\left(a^2+b^2+c^2\right)\left(a+b+c\right)+\left(ab+bc+ac\right)^2}{\left(a+b+c\right)^2-\left(ab+bc+ca\right)}\)
\(=\dfrac{a^3+a^2b+a^2c+ab^2+b^2+b^2c+ac^2+bc^2+c^3+a^2b^2+b^2c^2+a^2c^2+2ab^2c+2a^2bc+2abc^2}{a^2+b^2+c^2+2ab+2bc+2ac-\left(ab+bc+ac\right)}\)
\(=\dfrac{a^3+a^2b+a^2c+ab^2+b^3+b^2c+ac^2+bc^2+c^3+a^2b^2+b^2c^2+a^2c^2-2ab^2c+2a^2bc+2abc^2}{a^2+b^2+c^2+ab+ac+bc}\)