Body identification is a subfield of forensic science wherein investigators need to identify a body. Forensic (literally, "for the courts") purposes are served by rigorous scientific forensic identification techniques, but these are generally preceded by simply asking bystanders or other persons for the victim's name.
If a body is not badly decomposed or damaged, two persons (or one) who knew the deceased well should visually confirm the identity.
Authorities will also compare supportive documents such as driver's license, passport, or other authoritative photo ID before accepting a personal identification with which to further their investigative and/or forensic purposes.
Of course, any formal investigation should "reality check" additional forensic and scientific evidence to reinforce or question the supposed identity of the victim. Reliable identification becomes increasingly difficult as time passes.