On a winter's night in January 1995, rain fell on the Haute-Provence Observatory in southern France. Didier Queloz, an astronomy graduate student, was supposed to be observing. But since the weather was not cooperating, he sat in the library, writing computer code to make sense of the data he had so far. 

The data suggested a bright star called 51 Pegasi was wobbling ever so slightly. It was the kind of wobble Queloz was looking for – a stellar jostling that could mean the presence of a planet.

The discovery of a planet around another star would be one of the most profound in human history. It would prove the Solar System was not alone. It would propel us closer to knowing if other life was out there, and redefine our place in the Universe.

That made history. It shook the entire field.

So Queloz had to be sure. Eventually, after more data and analysis, he realised the wobble was indeed real, caused when an orbiting planet's gravity tugs at the star. "At this time, I was the only one in the world who knew I had found a planet," Queloz says. But he also knew he could have made a mistake, and the stakes were high. "I was really scared, I can tell you."

He turned out to be right. "That made history," says Steve Vogt, an astronomer at the University of California at Santa Cruz, US. "It shook the entire field."

Today, thanks to the Kepler space telescope, astronomers have discovered thousands of planets. According to estimates, our galaxy teems with hundreds of billions of worlds – including Earth-sized ones that could harbour liquid water, teasing us with the potential for life. In August 2016, astronomers reported that the nearest star, Proxima Centauri, is orbited by one of these Earth-sized planets.

But no one could have predicted these developments 20 years ago, when Queloz and his advisor, Michel Mayor of the University of Geneva, Switzerland, announced their discovery of the planet known as 51 Peg b. It was an extraordinary claim, and, as in science, the discovery was met not with fanfare but with scepticism.

To be clear, Mayor and Queloz did not actually discover the first planet outside the Solar System, known as an exoplanet.

If you [went] to an astronomy meeting and people asked what you do, you couldn't say you were looking for planets

In 1992, American astronomers Alex Wolszczan and Dale Frail found two planets. But instead of orbiting a normal star like the Sun, the planets orbited a dead one: a rapidly-spinning stellar corpse called a pulsar, which blasts powerful beams of radiation into space.

It was a bizarre planetary system that could not be hospitable to life. "Those didn't feel like planets because of the hellacious conditions," Vogt says.

Astronomers viewed these pulsar planets as a cosmic anomaly: intriguing but not necessarily groundbreaking. They have since only found three more planets around pulsars.

Finding planets around normal stars like the Sun just seemed too difficult. "If you [went] to an astronomy meeting and people asked what you do, you couldn't say you were looking for planets. They would move away from you like you smelled bad," says Paul Butler, an astronomer at the Carnegie Institution of Science. "You might as well be talking about little green men."

Our goal all along was to find planets

He should know. With Geoff Marcy, both at San Francisco State University in the US at the time, Butler had embarked on the search for exoplanets in 1986.

Using Vogt's state-of-the-art instruments, they were trying to detect the same kind of stellar wobbles that Queloz saw. For example, Jupiter – the most massive planet in the Solar System – causes the Sun to move at roughly 35km/h. Detecting those relatively slow velocities from trillions of kilometres away is not easy. Until the 1980s, Butler says, no one could measure any speeds slower than about 1,000km/h.

To detect these stellar wobbles, they needed to measure the star's spectrum; how the starlight splits into its constituent wavelengths. When the star moves towards or away from you, the wavelength of its light shortens or lengthens, respectively. This tiny change is called a Doppler shift. The problem was that vibrations in the instrument, fluctuating temperatures and other factors overwhelmed it.

To have any hope of finding planets, they had to eliminate those uncertainties. "Our goal all along was to find planets," Butler says. "That was always in the back of our minds. But in the forefront of our minds, it was the technical challenge."

A breakthrough had come in the early 1980s. Two Canadian astronomers named Bruce Campbell and Gordon Walker pioneered a technique that could detect wobble speeds of 54km/h. Such sensitivity would have enabled them to discover the first exoplanet long before Queloz and Mayor, Butler says. The Canadians were just unlucky.

If you inhale hydrogen fluoride vapour, you will die within a day and nobody can save you

To achieve their precision, Campbell and Walker placed a container of hydrogen fluoride gas in the telescope. The gas absorbs certain wavelengths of starlight, producing a spectrum. Any temperature fluctuations or other errors would affect both the gas's and the star's spectrum equally. If the astronomers found a shift in the spectrum of the star in comparison to the gas, then they could be confident it was really due to a Doppler shift. 

One problem, however, was that hydrogen fluoride was nasty. "If you get some on your skin, it destroys your nerve cells so you don't feel pain. It will eat its way to the bones," Butler says. "If you inhale hydrogen fluoride vapour, you will die within a day and nobody can save you."

Butler's solution was to swap it for iodine gas. It would still take years to hone their technique and write the necessary software, but by May 1995, they would be able to measure speeds down to 10km/h, a new record.

Five months later, however, they received news from Europe. Someone else had just found a planet: 51 Peg b.

It took several months before Mayor was convinced of 51 Peg b. He was understandably sceptical, telling Queloz to do more analyses to rule out alternative explanations. "I was a student," says Queloz, now at the University of Cambridge. "I was not supposed to find a planet."

His thesis had been to design and build the instrument used to detect 51 Peg b. While Butler and Marcy's technique was based on existing instruments, Queloz and Mayor built their device from scratch. Instead of using a container of gas, Queloz and Mayor's device avoided errors by keeping the starlight as isolated as possible.

The weird thing is that its orbit only takes four days to finish

Optical fibres, which kept the light pure and stable, channelled the starlight away from the unpredictable environment of the telescope and into a temperature-controlled instrument that measured its spectrum. Today, both approaches remain the workhorse technologies for finding planets via stellar wobbles.

Mayor and Queloz kept their work a secret while they checked and double-checked their analysis. Finally convinced, they announced their discovery on 6 October 1995 at an astronomy meeting in Florence, Italy. 

"It was a complete surprise from our end," Butler says.

Most astronomers were sceptical, and rightfully so. Researchers had previously claimed exoplanet discoveries that turned out to be wrong. And there was the issue of 51 Peg b itself. 

The planet is a big ball of gas like Jupiter. But the weird thing is that its orbit only takes four days to finish. The planet is six times closer to its star than Mercury is to the Sun, so close that its surface bakes at 1,000C. The heat puffs up its atmosphere, making it 50% larger than Jupiter, even though it is 47% lighter. Dubbed a "hot Jupiter," it contradicted everything scientists thought about planet formation. 

We looked at the results and were stunned

In the Solar System, gas giants like Jupiter live far from the Sun. These planets contain gases and ices, volatile compounds that could not survive in the hotter environment closer to the Sun. That is why, scientists thought, only small rocky planets like Earth could form in the inner Solar System, while gas giants formed in the outer part. 

The paradox of a hot Jupiter led many scientists to question 51 Peg b. "The mindset at the time was that all planetary systems should resemble our own," Butler says.

By chance, Butler and Marcy were scheduled for a four-night observing run a week later. They spent every night pointing the telescope at 51 Pegasi. They processed the data as soon as they returned. 

"We looked at the results and were stunned," Butler says. "Mayor and Queloz were right. We exactly matched their prediction."

Vogt was not yet working with Butler and Marcy. But he had been following their progress, and what surprised him about the data was that once they knew what to look for, 51 Peg b was not that hard to detect. Because of the short orbit, only a few days' worth of data was enough to reveal the star's wobble.

"If they're that easy to detect, there's going to be a lot of them," he says. "They're going to start falling from the sky." Realising 51 Peg b was just the beginning, he joined the hunt.

Even while Butler and Marcy were improving their technique, they had been observing stars, accumulating eight years of data. But they did not have the computing power to analyse them. With the discovery of 51 Peg b, other researchers, aware that Butler and Marcy might be sitting on undiscovered planets, offered their spare computers for use. And Vogt was right. The planets kept coming.

I couldn't believe it at first. For about an hour, I just stared at the computer

On the morning of New Year's Eve 1995, Butler went to his office to check on his computer program, which was analysing a star called 70 Virgo. The Sun was just rising, and the empty building was still dark. Sitting at his desk, he saw that his program revealed a planet seven times as massive as Jupiter, orbiting its star every 116 days. The star wobbled with speeds of more than 1,000km/h: the brightest and clearest signal yet, leaving no doubt it was a planet.

"I couldn't believe it at first," Butler says. "For about an hour, I just stared at the computer. I had a strange impression that Kepler was staring right behind me."

As the Americans found planet after planet, so would the European team led by Mayor. The two rivals would end up discovering hundreds of planets, as the competition grew fierce for the next decade.

 

Most of the early planets were hot Jupiters like 51 Peg b. Because these planets are big and close to their stars, they induce the most vigorous wobbles, making them the easiest to spot. Over the next couple of years, even the most ardent sceptics – who proposed alternative explanations like pulsating stars, binary stars, and star spots – had to accept that these were real planets.

51 Peg b forced astronomers to be more open-minded

But how they formed is still uncertain, even today.

One of the most popular explanations is that Jupiter-like planets migrate. They form far from their stars, but then move inwards due to gravitational interactions with other planets and the dust and debris left over from the solar system's formation.

But in August 2016, Konstantin Batygin, an astrophysicist at the California Institute of Technology, US, and others proposed that conditions near the star might not preclude the formation of Jupiter-like planets. Many hot Jupiters can, in fact, form where they are.

If anything, 51 Peg b forced astronomers to be more open-minded. It showed that when it comes to planets, anything goes, says Sara Seager, an astronomer at the Massachusetts Institute of Technology, US. "It set the stage for the entire field to expect surprises."

In fact, the Kepler space telescope found that most planetary systems look nothing like the Solar System. Launched in 2007, the telescope found thousands of worlds. Instead of the wobble method used to find 51 Peg b, Kepler looked for dips in starlight when a planet passes in front of it.

Kepler found planetary orbits that are inclined, highly elliptical, and go against the direction of the star's rotation. Some planets orbit two stars at once. The most common planet appears to be bigger and puffier than Earth: a "super Earth", which no one even knew existed.

It's a basic human thing to understand: are we alone or not?

Planet-spotters are now so skilled that they have found an Earth-sized planet, which could have liquid water, around our stellar neighbour Proxima Centauri; only 4.2 light years away. This discovery has inspired ambitious plans for interstellar travel.

With space telescopes like Kepler and the upcoming Transiting Exoplanet Survey Satellite (TESS), which might find thousands more worlds, astronomers are viewing planets not as individuals but as entire populations. This gives them a broader understanding of how planets form and how unique the Solar System might be.

Soon, a new generation of telescopes will probe planetary atmospheres for signs of life. Within decades, we may find the first evidence for aliens.

"It's a basic human thing to understand: are we alone or not?" Vogt says. "It's one of the most profound questions we can ever imagine. Either way, it's going to shake our culture, our entire way of thinking if we can answer that."

Join over five million BBC Earth fans by liking us on Facebook, or follow us on Twitter and Instagram.

If you liked this story, sign up for the weekly bbc.com features newsletter called "If You Only Read 6 Things This Week". A handpicked selection of stories from BBC Future, Earth, Culture, Capital, Travel and Autos, delivered to your inbox every Friday.