Often when you buy an SMD microcontroller (say AVR) or a PCB with an SMD microcontroller it comes preloaded with whatever program that board uses to run. I was wondering how it is preloaded - I guess DIP ICs could be programmed using DIP sockets, so are there special SMD sockets?
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.
Yes, there certainly are device sockets for SMD devices. They are routinely used for production and reliability testing of SMT components. Production testing is usually done using a device handler, essentially a robotic device that transfers the parts to be tested to and from the socket(s) on the production test equipment.
The same production test equipment is capable of programming the devices at the factory (practical only for large volume purchases), or a distributor and/or end customer can program the parts.
-- edited to add a link to a stand-alone automated programming system. --
I see you have already gotten a couple of good answer. Perhaps my writeup on in-circuit programming of Microchip PICs will give you some additional background and help demystify the process in general.