DNA, which is an abbreviation for deoxy-ribonucleic acid (meaning it's RNA with an -OH group missing from the 2 position of the sugar), is slightly simpler to synthesize than RNA, due to the fact that there's one less OH group needing protecting. There are several technical hurdles to automating this process (all of which have of course been surmounted).

One hurdle is, how do we do the chemistry we want and NOT the chemistry we don't want? DNA, which is a deoxyribose sugar backbone connected in a chain with bases hanging off of each chain and a phosphate group between each sugar, has so many functional groups it seems like one would be doomed to unsavory product mixtures. Which means it would be impossible to make a DNA sequence of any length without doing extensive purification processes at each step, which is so time-consuming and expensive as to be essentially impossible.

The key to solving this problem is the use of protecting groups. Protecting groups are little functional groups that deactivate what would be an annoyingly reactive functional group. First, how to make the sugars react together in the right order (and not with each other)?

DNA in nature is synthesized 5' to 3', but we aren't talking about nature here. Turns out, it's slightly easier to do it 3' to 5' in a lab. The first step in the automated synthesis is to take a bunch of silica that has amine groups attached to it, molecular formula essentially like this:

H2N-CH2-CH2-CH2-SiO2(solid support)

and react it with a nucleotide with a DMT group attached to the 5' hydroxy end. Now, a DMT group is a carbon attached to a benzene ring and 2 4-methoxy benzene rings. The way you get the DMT on there is you buy it that way. There are chemical ways to get that on, but they aren't relevant to DNA synthesis so I leave that to other noders. In addition to the DMT group, the first nucleotide gets an activated linker attached (a diester) to the 4' hydroxy group. The reason for that is, the amine (H2N group) is a nucleophile, and esters have carbonyl carbons, one of which in particular is reactive enough to let the nucleotide hook onto the silica.

Once this is done, you get to start adding nucleotides. The process is a simple 3-step one which is repeated many times in the machine. I'll detail the steps in just a bit, but first there's an important new thing about the nucleotides we're going to be throwing in: instead of that diester we used to hook it onto the silica, we'll be throwing on a phosphoramidite. Their structure looks like this:

OR
|
P-NR''2
|
OR'

The particular phosphoramidite which one might use has R as the nucleotide we want to add (with it's DMT group attached), R' as follows:

(C≡N-CH2-CH2-)O

And R'' as an isobutyl group. This shall be referred to as a "protected nucleotide" henceforth for the discussion.

Step one: DMT hydrolysis. This is accomplished with mild acid, and the purpose of this step is to let the nucleotide (or sequence) attached to the silica react with what you're about to throw in.
Step two: throw on the next protected nucleotide in the sequence (which has a DMT group to keep it from reacting with the other nucleotides of the same type you threw in). This will react with the chain you've got on the silica, and react precisely once because you've got a DMT group on the 5' hydroxyl, so it can't react further until you deprotect it.
Step three: oxidize the phophoramidite to the proper oxidation state for DNA. Currently it is only bound 3 times to oxygen. We need ultimately a valence of 5 (that's 5 P-O bonds in this case). This is accomplished by adding molecular Iodine, water, THF (a common organic solvent), and 2,6-dimethylpyridine, and the details of this mechanism would be a digression.

This steps can be repeated again and again in the sequencing machine. Thanks to this technique, you can order DNA from some company and they'll ship you the sequence you want.

However, we're not quite done yet. Because you know those bases I mentioned earlier, connected to the sugars? They're pretty reactive themselves, so won't that just muck everything up?
Well, thanks once again to protecting groups, we don't have to worry. Thymine doesn't require a protecting group, but Cytosine, Adenine, and Guanine do, because they have nasty primary amines. To deal with this, you buy them with a group like this, in the case of Cytosine and Adenine:

|
C=O
|
Ph
where Ph stands for Phenyl

and in the case of Guanine, a group like so:

|
C=O
|
CH
|
(CH3)2

OK, so now we've got this 'nucleotide', but that phosphate group still has an alkyl chain attached to one of its oxygens and 3 of the four bases have protecting groups which, while useful for synthesis, render the molecule definitely not DNA. What happens now?
Fortunately, all this mess can be cleared away in a single step, using just ammonia and water. Just add that, and your work is done. Take that DNA home and do whatever you will with it.
A great chemistry book which provides the background necessary to understand everything I just told you is Organic Chemistry: Structure and Function by K. Peter C. Vollhardt and Neil E. Schore. It has lots of pretty pictures and is fairly readable, though it's over a thousand pages so it's not exactly a bedtime story.