Whether it's a police detective who investigates crimes or a private detective hired by a husband to uncover his wife's affair, a detective is someone whose job is to find out hard-to-get information.
Detective comes from the Latin root detectus meaning to uncover or expose. Detectives detect, or discern and uncover the truth, the way a dog might detect an odor and uncover a bone. Sherlock Holmes, perhaps the most famous detective in fiction, used disguises, deductive reasoning and forensics to solve crimes. "When you have eliminated the impossible, whatever remains, however improbable, must be the truth," he famously said.