First, he noticed that the sand looks pretty uniform. You wouldn't be able to tell one patch of sand from another. So he just picked a random 200x200px square of sand.
Using this sample of sand, he analyzed the color distribution. Looking at it, he decided the color of a given pixel of sand-sample can be modelled reasonably well by assuming a random gaussian distribution (think bell curve).
Next, he assumed the whole picture was sand. The black-and-white image at the end is essentially a plot of the likelihood that the corresponding picture in the original picture would have been a grain of sand, assuming the normal distribution found earlier. Black means "very likely" and white means "not so likely".
Since we argued earlier that any patch of sand in this picture is as good as any other, all of the sand appears black. The rover, and crucially, the foreign object, do not fit the modelled distribution, so they stand out in stark contrast.
After he had the rover and bright object showing up white and the sand showing up as black, he removed any large connected white objects (In any image the largest block of 'non sand' would always be the rover). He then drew a circle around anything left over, which in this case was the mystery bright object.
The beauty of his approach is that its generic and can be applied to any photo of sand and rover to find interesting anomalies.
You can choose patches randomly, but they probably also have good enough telemetry and modeling to be able to predict which areas in any given picture are going to show part of the rover. That data can be used to ensure that your random patches don't include rover parts.