I need to make it clear that though Google is indeed a "complicated" machine.
Google can't "detect" good content. They can't "detect" the motive of a link. And they can't "detect" a legitimate site from one that's been built for promotional purposes. They truly can't. What they can detect though, are on-site relevance & UX factors, off-site trust factors, and behavioral data from their own user base (people using Google & Chrome).