Question: Why did Lennon and McCartney write a song together?
About the article "I Want to Hold Your Hand", section "Background and composition".

Candidate passages:
According to British journalist Barry Miles, after Lennon and Ono had been injured in a car accident in June 1969, partway through recording "Abbey Road", a bed was installed in the studio with a microphone so the latter could make artistic comments about the album.
According to Miles, Ono's continual presence in the studio during the latter part of the Beatles' career put strain on Lennon's relationship with the other band members.
George Harrison verbally assaulted her after she took one of his chocolate digestive biscuits without asking.
The British press dubbed her as "the woman who broke up the Beatles", but Ono has stated that the Beatles broke up themselves without any direct involvement from her, adding "I don't think I could have tried even to break them up.
"While the Beatles were together, every song written by Lennon or McCartney was credited as Lennon–McCartney regardless of whether the song was a collaboration or written solely by one of the two (except for those appearing on their first album, "Please Please Me", which originally credited the songs to McCartney–Lennon).
In 1976, McCartney released a live album called "Wings over America", which credited the five Beatles tracks as P. McCartney–J.
Lennon compositions.
Neither Lennon nor Ono objected.
After Lennon's death, McCartney again attempted to change the order to McCartney–Lennon for songs that were solely or predominantly written by him, such as "Yesterday," but Ono would not allow it, saying she felt this broke an agreement that the two had made while Lennon was still alive, and the surviving Beatle argued that such an agreement never existed.
The two other Beatles agreed that the credits should remain as they always had been, and McCartney withdrew his request.
In a "Rolling Stone" interview in 1987, Ono pointed out McCartney's place in the process of the disintegration of the band.
On the 1998 John Lennon anthology, "Lennon Legend", the composer credit of "Give Peace a Chance" was changed to "John Lennon" from its original composing credit of "Lennon–McCartney."
Although the song was written by Lennon during his tenure with the Beatles, it was both written and recorded without the help of the band, and released as Lennon's first independent single under the "Plastic Ono Band" moniker.
Lennon subsequently expressed regret that he had not given co-writing credit to Ono instead, who actually helped him write the song.
In 2002, McCartney released another live album, "Back in the U.S. Live 2002", and the 19 Beatles songs included are described as "composed by Paul McCartney and John Lennon", which reignited the debate over credits with Ono.
Her spokesperson Elliott Mintz called it "an attempt to rewrite history."
Nevertheless, Ono did not sue.
In 1995, after the Beatles released Lennon's "Free as a Bird" and "Real Love", with demos provided by Ono, McCartney and his family collaborated with her and Sean to create the song "Hiroshima Sky is Always Blue", which commemorates the 50th anniversary of the atomic bombing of that Japanese city.
Of Ono, McCartney stated: "I thought she was a cold woman.
I think that's wrong ... she's just the opposite ...
I think she's just more determined than most people to be herself."
Two years later, however, Ono publicly compared Lennon to Mozart, while McCartney, she said, more closely resembled his less-talented rival Salieri.
This remark infuriated Linda McCartney, who was dying from breast cancer at the time.
When Linda died less than a year later, McCartney did not invite Ono to his wife's memorial service in New York.
Accepting an award at the 2005 Q Awards, Ono mentioned that Lennon had once felt insecure about his songwriting.
She had responded, "You're a good songwriter.
It's not June with spoon that you write.
You're a good singer, and most musicians are probably a little bit nervous about covering your songs.
"In an October 2010 interview, Ono spoke about Lennon's "lost weekend" and her subsequent reconciliation with him.
She credited McCartney with helping save her marriage to John.
"I want the world to know that it was a very touching thing that he did for John."
While visiting with Ono in March 1974, McCartney, on leaving, asked "[What will make you come back to John?"
McCartney subsequently passed her response to Lennon while visiting him in Los Angeles.
"John often said he didn't understand why Paul did this for us, but he did."
In 2012, McCartney revealed that he did not blame Ono for the breakup of the Beatles and credited Ono with inspiring much of Lennon's post-Beatles work. 
Written in early 1962, "Ask Me Why" is principally a John Lennon composition, but was credited to Paul McCartney and John Lennon, as were all other Lennon–McCartney originals on the first pressings of "Please Please Me" album.
Paul McCartney: "It was John's original idea and we both sat down and wrote it together, just did a job on it.
It was mostly John's."
(Barry Miles.
Paul McCartney: Many Years From Now).
It was part of their live act prior to their recording contract, and was one of the songs performed at their Parlophone audition in EMI's Abbey Road studio three on 6 June 1962.
The song emulates in style that of Smokey Robinson and the Miracles, by whom Lennon was influenced, and draws its opening guitar phrase from the Miracles’ "What’s So Good About Goodbye" (1961). 
Under the Lennon–McCartney moniker, McCartney had written three previous Peter and Gordon singles (viz.
“A World Without Love”, “Nobody I Know”, and “I Don't Want to See You Again”).
On this occasion, McCartney used the pseudonym Bernard Webb (though some Capitol pressings carry the name A. Smith instead) to see if the song would be a success without the Lennon–McCartney credit.
McCartney commented at a press conference in August 1966, "People come up to them and say, 'Ah, we see you're just getting in on the Lennon–McCartney bandwagon'.
That's why they did that one with our names not on it... because everyone sort of thinks that's the reason they get hits."
However, the publishing credit was Lennon and McCartney's company Northern Songs, and according to Gordon Waller it took only two weeks' time for the song's real author to be revealed, as the first review of the record said, "This Bernard Webb has an amazing talent.
Could even be Paul McCartney!"
It was then introduced as written by McCartney when Peter and Gordon performed it on the US TV show "Hullabaloo". 
The song's lyrics describe the titular "fool", a solitary figure who is not understood by others, but is actually wise.
McCartney said the song relates to someone like Maharishi Mahesh Yogi:Alistair Taylor, in the book "Yesterday", reports a mysterious incident involving a man who inexplicably appeared near him and McCartney during a walk on Primrose Hill and then disappeared again, soon after McCartney and Taylor had conversed about the existence of God; this allegedly prompted the writing of the song.
McCartney played the song for John Lennon during a writing session for "With a Little Help from My Friends", and Lennon told him to write it down.
McCartney did not; he was sure he would not forget it.
In his 1980 interview with "Playboy", Lennon said, "Now that's Paul.
Another good lyric.
Shows he's capable of writing complete songs."
Lennon–McCartney (also written Lennon/McCartney and occasionally known as McCartney–Lennon) is a rock music songwriting partnership between English vocalists John Lennon (October 9, 1940December 8, 1980) and Paul McCartney (born June 18, 1942) of The Beatles.
It is one of the best-known and most successful musical collaborations in history.
Between 1962 and 1969, the partnership published approximately 180 jointly credited songs, of which the vast majority were recorded by the Beatles, forming the bulk of their catalogue.
Unlike many songwriting partnerships that comprise separate lyricist and composer, both Lennon and McCartney wrote words and music.
Sometimes, especially early on, they would collaborate extensively when writing songs, working "eyeball to eyeball".
Later, it became more common for one of the two credited authors to write all or most of a song with limited input from the other.
""He provided a lightness, an optimism, while I would always go for the sadness, the dischords, the bluesy notes"", John Lennon explained in his 1980 Playboy interviews.
By an agreement made before the Beatles became famous, Lennon and McCartney were credited equally with songs that either one of them wrote while their partnership lasted.
Lennon–McCartney compositions have been the subject of numerous cover versions.
According to Guinness World Records, "Yesterday" has been recorded by more artists than any other song.