Vertigo's score was composed and orchestrated by Oscar and BAFTA winner Bernard Herrmann. Herrmann had a stellar career in film composing, working with directors from Orson Welles on Citizen Kane (1941) to Martin Scorsese in Taxi Driver (1976). It was with Hitchcock, though, that he was part of one of the most successful director-composer collaborations in film history. (We'd say the most successful, but there's that John Williams-Steven Spielberg situation.)
Herrmann was Hitch's go-to guy for music, despite having the reputation of being controlling and abrasive, and having insulted practically everyone in the business. They worked together on nine films between 1955 and 1964, plus 17 episodes of Hitchcock's TV program, The Alfred Hitchcock Hour. It was Herrmann who gave us that jarring, screechy violin accompaniment to the shower scene in Psycho. New York Times critic Alex Ross believed that Vertigo's score was Herrmann's masterwork. Hitchcock always gave Herrmann tons of credit for his films' successes.
The complex score included swelling strings during the romantic interludes, Spanish-inflected music to reflect the Spanish history of California, and what's known as the "Vertigo chord, " a high, dissonant chord that accompanies Scottie's terrified episodes of vertigo. You can listen to it here.
Here's how Alex Ross describes it:
"The music rotates in tandem: endless circles of thirds, major and minor, interspersed with shuddering dissonances. […] The music literally induces vertigo: it finds no acceptable tonal resolution and spirals back on itself. Herrmann has told us what the movie is about." (Source)
During the long sequence when Scottie follows Madeleine on her strange wanderings around the city, the music is beautifully eerie and hypnotic. And just listen to what he does during the scene where Judy final emerges transformed into Madeleine. As one critic put it, "There's no dialogue, and it isn't necessary" (source). In the final scene, there's a sinister theme when Scottie confronts Madeleine that alternates with a more hopeful theme until it builds into a shocking crescendo as Judy jumps off the tower, leaving Scottie to contemplate what's just happened.
There is some music in the film that Herrmann didn't compose: background music from a phonograph, played by Midge. One's a Mozart composition, and one's by Bach—pretty traditional composers. Scottie asks her to turn off the Mozart piece she's playing in her apartment. It's also played in the sanitarium where he's sent after Madeleine's death, and Midge tells the doctor that Mozart's not going to help Scottie. These pieces are a way showing us that Midge is a more conventional person than Madeleine who has Herrmann's mysterious and melodramatic musical score to accompany her scenes.
Herrmann and Hitch ended their relationship because of some "creative differences" about the score for 1966's Torn Curtain. Hitchcock was under pressure from the producers to produce a more pop score, since teenagers were now the ones driving the commercial success of films. Herrmann pretty much said, "Are you kidding me?" He composed what he wanted for the film, and in the middle of the project, Hitch fired him and the orchestra. They never really spoke again.
BTW, Torn Curtain was a box-office and critical disaster.