How are SMD microcontrollers preloaded with code?
Most microcontrollers have an in-circuit programming (ICP) capability; you can program them over a few digital I/O lines through JTAG or whatever, by powering up the printed circuit board and hooking up a cable from the board to a PC. This is possible by using programming signals that are at regular logic levels. (Microchip had a high-voltage in-circuit programming approach where the reset line MCLR had to be held at a high voltage (12V?) which was OK only by adding an isolating diode between MCLR and the rest of the circuit.)

In the earlier days before ICP, you could buy large numbers of ICs from the manufacturer, programmed by them, as a value-added service. Small numbers would have to be programmed by you or someone else.

As far as sockets go -- there are sockets for almost everything. A few years ago I was working recently with an MSP430 kit that had a clamshell socket for a 64-pin QFP. They're not cheap but they work well. (Here's one for a 400-pin BGA good to 10GHz) They get used mostly for testing purposes rather than programming.