\(M=a^3+b^3+3ab\left(a^2+b^2\right)+6a^2b^2\left(a+b\right)\)
\(=\left(a+b\right)\left(a^2-ab+b^2\right)+3ab(\left(a+b\right)^2-2ab)+6a^2b^2\left(a+b\right)\)
\(=\left(a+b\right)\left(\left(a+b\right)^2-3ab\right)+3ab\left(\left(a+b\right)^2-2ab\right)+6a^2b^2\left(a+b\right)\)
\(=1-3ab+3ab\left(1-2ab\right)+6a^2b^2\)
\(=1-3ab+3ab-6a^2b^2+6a^2b^2\)
\(=1\)