What motivated Einstein to formulate general relativity? I never really fully understood what motivated general relativity or why the Newtonian concept of gravity was considered problematic.
One thing I always hear is that it is because it doesn't address what causes two masses at a distance to be attracted.  Maybe quantum mechanics aside, nobody seemed to have a problem with two electrons at a distance repelling each other.
One thing I read is that mass is performing double-duty being both a resistance to a change in velocity and a cause of gravitational fields.  I can see that being a curiosity but not convinced that it is a problem.
Ok, gravitational field changes propagating instantly might be a reasonable motivation.
Mercury's orbit may be a problem solved by general relativity but I don't see it being the motivation to come up with the theory.  One would only know it solves the problem after the theory is fully developed.
I have never studied general relativity at any sort mathematical level and I've always been curious about this.
 A: William Clifford, a British physicist and mathematician, inspired by Riemann's notion of a manifold, a generalisation of non-Euclidean geometry, published in 1876 a small note in the Proceedings of the Cambridge Philosophical Society titled The Spacetime Theory of Matter. Here he wrote a full fifty years before Einstein formulated General Relativity, the following:


*

*That small portions of space are in fact of a nature analogous to little hills on a surface which is in the average is flat; namely, that the ordinary laws of geometry are not valid on them.





*That this property of being curved or distorted is being continuously being passed from one portion of space to another after the manner of a wave.





*That this variation of the curvature of space is what really happens in the phenomena which we call the motion of matter, whether ponderable or etherial.





*That in the physical world nothing else takes place but this variation, subject (possibly) to the law of continuity.


The qualitative parallel with Einsteins General Relativity is obvious. It's an open question whether Einstein was aware of Cliffords hypothesis. It wouldn't be any surprise if he was and nor, if he was, does it diminish his genius.
More generally, Clifford was answering a question of Newton as to how the force of gravity was transmitted. After all, Newton formulated gravity as 'an action at a distance' - meaning he couldn't formulate a way for the influence to travel tgrough empty space. This principle is called locality. Carlo Rovelli in his book, Quantum Gravity, considered it one of the supreme principles of physics. Einstein certainly felt so, it was the content of his dispute with Bohr on non-locality in QM. He simply couldn't envisage a non-local theory.
However, this principle is much older than that. It goes back to Aristotle in two ways: first he said forces are transmitted by touch and second, he said there was no such thing as a void (he gave five arguments for its non-existence).
So basically, physicists since Newton were looking for a local completion of Newtonian gravity. It was Faradays notion of a field that provided the key via Maxwells equations (Maxwell explicitly credited Faraday for the notion) as well as the tensor calculus of Riemann and Levi-Civita.
A: 
I never really fully understood what motivated general relativity or why the Newtonian concept of gravity was considered problematic.

The main problem, and certainly the issue which most motivated Einstein, is that Newtonian gravity is not consistent with relativity. Relativity places an upper limit on all causal influences, but Newtonian gravity has no such limit. So we needed a theory that has a speed limit but in the appropriate limit approaches Newtonian gravity.
So GR, by design, accomplishes those two goals. What is interesting are all of the other observations that it was not designed for and yet correctly predicted. This includes light deflection, time dilation, the precession of Mercury, frame dragging, and gravitational waves.
A: Einstein came up with General Relativity because he recognized that Special Relativity was not a good description of the universe (he couldn't make gravitation work sensibly within it).
He came up with Special Relativity because Newtonian physics had failed to accommodate light in any useful or consistent way.
