You asked for it
First you need clean glass, derived from sand and mixed with sodium carbonate and lime. River sand is the best because it has the less metal contamination which tints the glass. Then you must grind the surface to give it a concave or convex shape, originally this was done by hand, now they use machines. Needless to say that even microns of variance on the curvature of the surface play a major role in optical quality. To obtain the desirable refraction and make the surfaces anti-reflective various substances (coatings) are added to the glass, like thorium or lanthanum (now replaced by fluorite) that offer high refractivity and low dispersion so that chromatic aberration is eliminated. This is the basic process, however, different makers use different methods to build a lens. Since more than 1 glass element is needed to have an clean image with all wavelengths focused on the same film plane (or sensor) inside the camera you need an ingenious designer of optical systems, and most of these people are now dead, although some of their designs remain. Prime lens designs are easier for 50mm optics (known as standards) a bit more difficult for 35mm and even harder for 28mm, etc. They are easy again for 90mm and 135mm (as long as you keep to f4).
50mm primes usually are based on Double-Gauss symmetries, meaning they have central iris systems and equal number of elements on either side and cause the least aberrations both for chroma and sphere. They are cheaper to make (unless you go wild with apertures bigger than f2). The German factories of Zeiss and Leitz produced near-perfect optical systems (microscopy, binoculars, camera lenses) and hence their fame and reputation. Schott and Hoya still make the best glass in the market but digital sensors reveal the weaknesses of lenses more than films did in the past. Users today ask for more contrast, zero vignetting and better bokeh (whatever that means), so manufacturers are introducing aspherical surfaces to their optical systems. This obviously raises the cost. In my experience I have come across a number of excellent optics, like a Sonnar T 38/2,8 by Zeiss, a Planar on a Rolleiflex, a Summicron 2/50 by Leitz, but also some beautiful 50mm lenses by Pentax and Nikon (back in the 70s & 80s).
Still, even the number of diaphragm blades play a role in a lens. The "oils" and "glues" that keep the lens together working for decades must also be top quality. The focusing “throw” from infinity to 1 meter is another factor. Even the mount on the camera body ought to be micron precise, but the mechanics of a lens, the materials used for it etc, need another long and probably tedious article.