Periodically I prepare an imaginary lecture the purpose of which is to remind philosophers of physics, and indeed some physicists, that the quantum theory had its origins in experiments. Unlike general relativity which seems to have sprung from Einstein’s head, the quantum theory was a response to experiment. Even de Broglie’s conjecture that particles had also a wave-like nature was influenced by how this notion could be used to explain the quantization of the radii of the Bohr orbits. The experiment driven theoretical developments of the quantum theory began with Planck and have continued ever since.General relativity sprung from Einstein’s head? One of the persistent myths that I debunk in my book is that Einstein created relativity out of pure thought, with any input from experiment. Einstein himself promoted this myth in his later years, and paradigm shift philosophers have made it the centerpiece of bogus theories about how science works.
Usually the myth is told about the special relativity of 1905, as Einstein's biographers acknowledge that he relied heavily on others for general relativity.
The term general relativity means (special, spacetime, electromagnetic) relativity applied to gravity. It is called general because it is nonlinear. The first breakthru was in 1905, when Poincare discovered the space-time metric, proposed a Lorentz-invariant theory of gravity, and explained how gravity could propagate at the speed of light and still be consistent with solar system observations. A couple of years later he announced that he had figured out how to use relativity to partially explain an anomaly in Mercury's orbit.
Einstein's biggest breakthru was to deduce in 1907 that gravity had an apparent effect on clocks.
We know from Einstein's letters that he spent several years trying (off and on) to extend Poincare's work on Mercury. Others helped him on the problem. He also wanted to explain the deflection of starlight. His next big breakthru was in 1915 when he showed how Grossmann's 1913 relativity equations could be used to explain the Mercury anomaly. When Hilbert gave another derivation of Grossmann's equations in 1915, Einstein became convinced that those equations must be right. Einstein's famous general relativity paper was published in 1916, with an acknowledgement to Grossmann, but no mention of Poincare or Hilbert.
Thus relativity had its origin in experiments, just like quantum mechanics.
Update: A new paper on Einstein the Stubborn: Correspondence between Einstein and Levi-Civita has explained the correspondence between Einstein and Levi-Civita and Hilbert in 1914-16. The letters mostly consisted of Levi-Civita and Hilbert trying to convince Einstein of errors in his general relativity papers. Grossmann had introduced covariant equations in 1913, but Einstein did not accept them, and gave fallacious arguments for non-covariant equations. Einstein finally admitted in 1916 to Hilbert, "The error you found in my paper of 1914 has now become completely clear to me".