You define port pin as digital output, digital input not what is connected (LED, servo, etc). This is at the lowest level. One can abstract this at a higher level (function) that calls lower level functions to setup the pin's functions.
Another learning tool is the simulator in the IDE. With this you can step through the code and observe what is happening in each register and pin. A little knowledge of the under lining assembler code is useful to understand the hardware of the processor and what a 'C' statement is really doing.
The code you posted does have some 'C' constructs that are not the easiest to understand. One also needs to know the definitions of the names used (like 'DDD1'). So take the code one line at a time and learn what it does then study the processor's data sheet to learn what the code is doing in the processor's hardware.
This will take some time and effort but it is learn-able.
For standard C I recommend the K&R C programming book (I've have my copy for 25 years and still refer to it). http://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628
This is the bible for the C programming language and written by the guys that invented C. It is a complete reference and has some very good tutorials.
When you really get stuck on understanding a line of code then post a question about it for help.
I'll take the one line of code and explain what it does:
DDRD |= (1<<DDD1);
DDD1 is a whole number
DDRD is an AVR register
The part: 1<<DDD1
shifts a binary '1' left DDD1 times. If DDD1 = 1 then it shifts the '1' one binary place left to equal 0b00000010 or 0x02. (I know this only from the comment that it sets pin PD1 to an output.
the |= is reading the value in DDRD then logic OR with the shifted bit from the '1<<DDD1' part. What this does is set bit 1 in register DDRD to a '1' without change the value of the other bits in that register.
So to fully know what the line of code does one needs to know the value of DDRD and DDD1 as well as what the DDRD AVR register does in the hardware.
The defines for DDRD and DDD1 should be in a header file, possibly avr/io.h.
LEDs are current driven devices (require a series resistor to limit the current when driven from a logic output. Google and the Robot Tutorials (look at the top, right of this page) will give you the details.
Servos (RC hobby servos) are controlled by a variably width pulse. The processor drives an output pin high for 1 to 2ms and of for about 19ms. Typically this is done either with software timing loops or with some hardware (PWM module) built into the processor. Again use google the the Robot Tutorials.