In short, it looks for high contrast areas.
It usually restricts itself to either a pre-set area or a pre-set array of areas though, and it may also have a slight bias towards the centre of the picture, or at least away from the far edges.
In a shot like this it'll pick the dog, because the other areas are too low-contrast. This is a win, because it's what you would have wanted it to focus on. In a portrait, it will hopefully select one of the eyes, but it may fail if there is something high-contrast in the person's hair on on the person's clothes. In a busier scene there may be higher-contrast areas that you don't want to focus on.
It may also try to have a bit of bias toward closer objects. If anyone tells you that CDAF cannot tell relative distance they're wrong - while a single CDAF sample cannot tell distance, the autofocus system infers distance by taking multiple CDAF samples while the focus mechanism moves in or out - something that becomes sharper when moving the focus in is a closer object (in short, CDAF needs to take readings while moving the lens, then move the lens further).
Cameras with CDAF often have face detection these days which can be switched on or off - if on, it will prefer things that look like a face. If a face is not found, it'll just act like a multi-area autofocus, so there is no harm in leaving it on when not taking a face, except on the off-chance that it mistakenly detects something that isn't a face.
The way it selects focus areas is largely the same as for PDAF, by the way, except that PDAF can't do facial recognition, it is resticted to certain zones, and PDAF usually heavily favours the sensor in the middle of the screen especially in low-light, because that sensor is a more sensitive one.