As with many things in biology, evolution has come across many different solutions to the same problem, so there is no one solution that nature uses to recognize DNA. There are various structural domains that function primarily to recognize the major or minor groove of DNA (for major groove-binders, see for example the basic helix-loop-helix domain, or a zinc finger domain). One common theme for major groove binders, however, is insertion of an alpha helix along the major groove of the DNA (although I'm sure there are examples where the interaction does not involve an alpha helix).
For small molecules, there are various classes of molecules that scientists have designed to specifically recognize DNA. For an example of major groove binders, see the work on polyamides by Peter Dervan at Caltech.