Jeffrey Beaumont (Kyle MacLachlan) returns to his logging home town of Lumberton, North Carolina from Oak Lake College after his father suffers a near-fatal stroke. While walking home from the hospital, he cuts through a vacant lot and discovers a severed ear. Jeffrey takes the ear to police detective John Williams (George Dickerson) and becomes reacquainted with the detective's daughter, Sandy (Laura Dern). She tells him details about the ear case and a suspicious woman, Dorothy Vallens (Isabella Rossellini), who may be connected to the case. Increasingly curious, Jeffrey enters Dorothy's apartment by posing as an exterminator, and while Dorothy is distracted by a man dressed in a yellow suit at her door (whom Jeffrey later refers to as the Yellow Man), Jeffrey steals her spare key.
Jeffrey and Sandy attend Dorothy's nightclub act, in which she sings "Blue Velvet", and leave early so Jeffrey can sneak into her apartment to snoop. He hurriedly hides in a closet when she returns home. However, Dorothy, wielding a knife, discovers him and threatens to kill him. Believing his curiosity is merely sexual and aroused by his voyeurism, Dorothy makes Jeffrey undress at knifepoint and begins to fellate him before their encounter is interrupted by a knock at the door. Dorothy hides Jeffrey in the closet. From there he witnesses the visitor, Frank Booth (Dennis Hopper), inflict his bizarre sexual proclivities—which include inhaling an unidentified gas (possibly amyl nitrite), dry humping, and sadomasochism—upon Dorothy. Frank is an extremely foul-mouthed, violent sociopath whose orgasmic climax is a fit of both pleasure and rage. He continually refers to her as "Mommy" and to himself as both the "Daddy" and the "Baby", who "want to fuck." Frank has kidnapped Dorothy's husband and son to force her to perform sexual favors; to "Do it for van Gogh." When Frank leaves, a sad and desperate Dorothy tries to seduce Jeffrey again and demands that he hit her, but when he refuses, she tells him to leave. When Jeffrey moves to leave, she asks him to stay, though he leaves anyway.
Jeffrey relays his experience to Sandy, asking her why there are people like Frank. Sandy in turn tells him of a wonderful dream she had about robins that she interprets as a sign of hope for humanity. Jeffrey and Sandy find themselves attracted to each other, though Sandy has a boyfriend.
Jeffrey again visits Dorothy's apartment and she tells him that although she knows nothing about him, she has been yearning for him. Jeffrey attends another of Dorothy's performances at the club, where she sings the same song. At the club, Jeffrey spots Frank in the audience fondling a piece of blue velvet fabric he cut from Dorothy's robe. Jeffrey follows Frank and spends the next few days spying on him. Shortly afterwards, two men that Jeffrey calls the Well-Dressed Man and the Yellow Man exit an industrial building that Frank frequently visits. Jeffrey concludes the men are criminal associates of Frank, and tells his new findings to Sandy. The two briefly kiss, though she feels uncomfortable about going any further. Jeffrey immediately visits Dorothy again, and the two have sex. However, when he refuses to hit her, she pressures him, becoming more emotional. In a blind rage he knocks her backwards and is instantly horrified, but Dorothy derives pleasure from it.
Afterwards, Frank catches Dorothy and Jeffrey together and forces them both to accompany him to the apartment of Ben (Dean Stockwell), his suave, effeminate partner in crime who is holding Dorothy's son. Ben lip-syncs a performance of Roy Orbison's "In Dreams", sending Frank into maudlin sadness, then rage. Frank takes Jeffrey to a lumber yard and when he molests Dorothy, Jeffrey stands up to Frank by punching him. Frank's cronies drag Jeffrey out of the car and Frank kisses Jeffrey's face, intimidates him, and then savagely beats him to the overture of "In Dreams". Jeffrey wakes the next day at the same place and walks home, overcome with guilt and despair. He goes to the police station, where he notices that Sandy's father's partner is the Yellow Man—an officer named Lieutenant Detective Tom Gordon (Fred Pickler). Later, at Sandy's home, her father is amazed by Jeffrey's story, but warns Jeffrey to stop his amateur sleuthing lest he endanger himself and the investigation. Jeffrey and Sandy go to a dance together and profess their love, only to be confronted by Sandy's boyfriend. A confrontation is averted when the group finds Dorothy—naked, battered, and distressed—on Jeffrey's front lawn. Barely conscious, Dorothy reveals her intimacy with Jeffrey, causing Sandy to become upset and to slap Jeffrey, although she later forgives him.
Jeffrey insists on returning to Dorothy's apartment and tells Sandy to immediately send the police there, including her father. At Dorothy's apartment, Jeffrey finds Dorothy's husband (Don Vallens), who is dead from a gunshot to the head and identifiable by his missing ear, as well as the Yellow Man (Gordon), who bears a gruesome head wound and appears to have suffered a crude lobotomy. When Jeffrey tries to leave, he sees the Well-Dressed Man coming up the stairs and recognizes him as Frank in disguise. Jeffrey talks to Detective Williams over the Yellow Man's police radio, but lies about his location inside the apartment. Frank enters the apartment and brags about hearing Jeffrey's location over his own police radio. While Frank searches for him in the wrong room, Jeffrey retrieves the Yellow Man's gun and hides in the same closet in which he hid during his first visit to the apartment. Frank fires sporadically, knocking over the dead Yellow Man, who had still been standing up, and when he opens the closet door, Jeffrey fatally shoots him in the head. Detective Williams, gun drawn, enters with Sandy a moment later. Jeffrey and Sandy now go ahead with their relationship and note the unusual appearance of robins in their town. A montage sequence ends the film, which shows Dorothy and her son reunited.

Question: How did Jeffrey initially enter Dorothy's apartment to steal her spare key?
Answer: He impersonated a "bug man".