I am a student of civil engineering, focussing on the finite element method for solving partial differential equations approximately. During my lectures, as well as in books targeted at engineers, the finite element method is described as solving a weak form of the original problem with shape functions. Its mostly glossed over, why we use shape functions, opposed to any other mathematical method. I always get the feeling, that using them is a natural thing to do.
My question being: Was there a stroke of luck, when someone just put in a shape function (not knowing what will happen) into the weak PDE and just happened to stumble across a solution that works well enough?
Or was the introduction of shape functions just a logical necessity in a step by step rigourous mathematical argument? Or is it both and\or neither of the above?