On September 23, 1846, Johann Gottfried Galle at the Berlin Observatory pointed his telescope at a spot in Aquarius that Urbain Le Verrier had given him in a letter, and found a star of the eighth magnitude that was not on the chart. It was within a degree of where Le Verrier said it would be. Galle and Heinrich d'Arrest observed it again the next night and saw that it had moved. It was Neptune.
It happened on paper first. Uranus had been found by William Herschel in 1781, and by the 1820s it was clear that it was not following the orbit that the tables predicted; it was running ahead of its predicted position and then behind. The obvious explanation was an unseen planet pulling on it, and the less obvious problem was that the question was inverse: given where Uranus is wrong, where is the thing that is pulling it.
Two men solved it. John Couch Adams, a young Cambridge mathematician, finished his calculations in September 1845 and tried to get the Astronomer Royal, George Airy, interested, without much success. Le Verrier, working in Paris at the Bureau des Longitudes and independently, published three papers in 1846 and wrote to Galle in Berlin on September 18. Galle got the letter on the 23rd and looked that night.
The difference between them was not mathematics but persistence. Adams's results were as good as Le Verrier's and slightly earlier, and he had trouble getting anyone to look. Airy thought the discrepancy could be explained by an error in the Uranus observations, and when he did ask James Challis at Cambridge to search, in July 1846, Challis looked for it and saw it twice without realising what he had. Challis's notebooks show he recorded the object on August 4 and 12.
The quarrel followed immediately, and it was national before it was personal. French scientists wanted it to be Le Verrier's planet. The English, having missed it, then claimed a share for Adams. Arago in Paris proposed naming it Le Verrier, which foreign astronomers refused. Le Verrier himself behaved badly and refused to acknowledge Adams for years. Both men are now credited, and both went on to distinguished careers: Le Verrier took over the Paris Observatory, and Adams succeeded Airy as Astronomer Royal.
What it settled was bigger than a planet. Neptune's discovery was the strongest possible demonstration that Newton's mechanics were right, because it predicted something that nobody had seen, and the prediction was correct to within a degree. Neptune is about 4.5 billion kilometres from the sun, takes 165 years to orbit, and was visited once, by Voyager 2 in 1989.