A book by Isaac Asimov
In this novel, Isaac Asimov first introduced E. Bailey and R. Daneel which would later become his, and more so his readers', favourite protagonists. It is set in a near future where hyperspace travel has been discovered, and a few worlds relatively close to earth have been colonised -- the 50 spacer worlds. The spacer worlds use robots much more heavily, while in earth strict rules against robots are passed.
A Spacer ambassador, who tries to convince the earth government about both the importance of robots and of that of continuing space exploration and colonization, is murdered. Elijah, a detective for the earth police, is charged with finding the murderer. However, he gets a spacer partner -- a humanoid robotic spacer partner named R. Daneel Olivaw. Together, they search the caves of steels (the big cities which cover all of earth which have been founded as a response to the population crisis) for the murderer and trying to stop an interplanetary diplomatic incident which would mean the destruction of earth.
In "Caves of Steel" Asimov paints a grim situation of an earth which has become dictatorial/psuedo-socialist to deal with an extremely large population, and of luxury-seeking Spacers which limit birth so that each may have virtually unlimited grounds, wealth and privacy. "Caves of Steel" was where Asimov first introduced Elijah, who would later be remembered, tens of thousands years into the future, as the men who started the second immigration wave from earth but could not be on it (I assume the allusion to the biblical Moses is intentional) and Daneel Olivaw who thousands of years later will build Galaxia to help humanity deal with the threat of hostile aliens.
Isaac Asimov himself claimed that the reason Daneel got so much screen time was that his readers and publishers begged him to.