Firstly- very easy. It may have been done by deedpoll officially, or he may simply have started using another name. I believe it is true to say that one can use another name in this country without official paperwork as long as it is done without intent to defraud.
As for the reason... There are various reasons, from trying to avoid being found for marrying bigamously, avoiding issues as a result of a criminal record, from being illegitimate and already having the use of more than one surname as a result, from a mother remarrying and having the use of more than one surname as a result, honouring someone else (such as a more affluent or influential relative who might give him an inheritance or suchlike if he currys favour), actually receiving an inheritance/business and carrying on the established family name of that business... The inclusion of Robert may be for any of the above, or potentially if there was more than one John Stanley in the family he may have been known as Robert to differentiate him from the others.
-Edit... forgot about adoption... Once traced a guy who kept changing surname or using double barrelled surnames... turned out the family was from the US, came over to visit UK relatives, son fell ill and they abandoned him in the UK! He was "adopted" by the relatives over here and kept using different variations for the rest of his life.