Image from Bioinformaticsweb.org
The letters of the DNA code come from the bases; adenine (A), thymine (T), guanine (G) and cytosine (C). They code for amino-acids, which make up proteins, in groups of threes, i.e GCC codes for alanine, GGA codes for glycine etc.
Each base, along with the associated sugar and phosphate, forms its own little subunit. Joining these together in the correct order can code for any protein you want. As a Lab Rat I don't know very much about this process, except that I send the sequence off and get back a little vial full of DNA (or a stab containing the bacteria that have my DNA held on a separate plasmid). So what I'm writing here is just what I've managed to find out about the process - it might not reflect the most up-to-date method used in the top sequencing companies, but it's a plausible way to make DNA.
There are two main types of DNA synthesis. Firstly there's small sequence oligonucleotide (aka small-bit-of-DNA) synthesis, to make primers and things. Secondly there's whole gene synthesis, which deals with larger sections of DNA. As whole gene synthesis mostly involves sticking together little bits of DNA, I'm mostly going to focus on small oligonucleotide synthesis.
The basic process involves sticking the growing DNA strand to a solid support and then just washing the next DNA base through, over and over again. This is pretty much automated nowadays, so you just program a robot to do it. The supports used are mostly either Controlled Pore Glass or macroporous polystyrene (plastic with small holes to select for size, allowing the salts and bases to be washed away before the larger DNA molecule is eluted). Both of them covalently attach to the end of the DNA chain, holding it in place as the nucleotides are washed through.
In their natural state, however, nucleotides are not very reactive, so special modified versions are used. Large bulky groups such as DMT and cyanoethyl are used to block the ends of the bases and the phosphorous linkages, to stop them reacting or participating in reactions.
The first base is then attached to the support and the DMT group (attached to the bottom of the base - the five sided ring) cleaved off with an alkaline wash. The next subunit is then activated before being added to the support. This involves adding tetrazole, which cleaves off the three big rings shown on the left, making the subunit more reactive. The activated subunit is then washed through the column, where it can react with, and bind too, the preceding base.
Once all the bases have been added in the correct order the mixture is purified, to isolate the required sequence. This is done by desalting, usually with chromatography, to produce the final product.
In case anyone was wondering, the robot/machine/computer used for synthesis looks like this:
Image taken from monash university website.