I'm sorry if this is well known, but I don't know much about elections during that period. Thanks!
The Democratic Party was deeply divided at this time. Primarily in control of the party were the "Copperheads," who supported bringing the war to an immediate end and reaching a peace agreement with the Confederacy. However, a split faction known as "War Democrats" supported Lincoln's aggressive actions against the South and supported him leading up the the 1864 election.
As a result of this schism and out of interest in not isolating the War Democrats, the Republican party rebranded itself as the "National Union Party" for the upcoming election.
While Hannibal Hamlin had served adequately in the first term of Lincoln's presidency and there were no real qualms with his renomination, delegates at the convention that summer had interest in bringing a War Democrat onto the ticket under the new party name to unify the pro-war factions. Lincoln's reelection was a not a certainty at the time of the convention as the war was still contested. In the case of a tight election, War Democratic support would give Lincoln and this new party the edge.
Doris Kearns Goodwin attributes the actual selection of Johnson himself as opposed to other War Democrats to the behind-the-scenes machinations of a New York publisher and politician Thurlow Weed, who was an advisor to Secretary of State William Seward:
Always alive to the interests of his oldest friend, Seward, Weed at once understood that if New York's Daniel Dickinson [War Democrat and another VP contender] received the vice presidential nod, Seward might not retain his position as secretary of state. An unwritten rule dictated that two significant posts could not be allotted to a single state. Weed had initially supported Hamlin but soon saw that the growing sentiment for a War Democrat would result in the nomination of either Dickinson or Johnson. He placed the Weed-Seward machine behind the victorious Johnson.
Doris Kearns Goodwin, Team of Rivals (New York: Simon & Schuster, 2005), 625-626.
By November, Atlanta had fallen and Union victory was near. The election resulted in a decisive victory for Lincoln and Johnson.