A detective is an investigator, usually a member of a law enforcement agency. They often collect information to solve crimes by talking to witnesses and informants, collecting physical evidence, or searching records in databases. This leads them to arrest criminals and enable them to be convicted in court. A detective may work for the police or privately.
Informally, and primarily in fiction, a detective is a licensed or unlicensed person who solves crimes, including historical crimes, by examining and evaluating clues and personal records in order to uncover the identity and/or whereabouts of criminals.
In some police departments, a detective position is obtained by passing a written test after a person completes the requirements for being a police officer. In many other police systems, detectives are college graduates who join directly from civilian life without first serving as uniformed officers. Some argue that detectives do a completely different job and therefore require completely different training, qualifications, qualities, and abilities than uniformed officers. The other side says that a detective who has worked as a uniformed officer will excel as a private detective due to their knowledge about standard police procedures, their contact network and their own experience with typical problems.
Some are not public officials, and may be known as a private investigator, colloquially referred to, especially in fiction, as a "PI" or "private eye", "private dick" or "shamus".
The detective branch in most large police agencies is organized into several squads and departments, each of which specializes in investigation into a particular type of crime or a particular type of undercover operation, which may include: homicide, robbery, spot burglary, auto theft, organized crimes, missing persons, juvenile crime, fraud, narcotics, vice, criminal intelligence, aggravated assault/battery, sexual assault, computer crime, domestic violence, surveillance, and arson, among others.