The Datalink ensures that messages are delivered to the proper device and translates messages from the Network layer into bits for the Physical layer to transmit. It formats the message into data frames (notice how we are not using the term segments) and adds a customized header containing the hardware destination and source address.
This added information forms a sort of capsule that surrounds the original message (or data), think of it like grabbing a letter which has information and putting it into an envelope. The envelope is only used to get the letter to its destination, right? So when it arrives at the addressee, the envelope is opened and discarded, but the letter isn't because it has the information the addressee needs.
Data traveling through a network works in a similair manner. Once it gets to the destination, it will be opened and read (processed). This is illustrated in the Data Encapsulation - Decapsulation section. Some common protocols which work at the Datalink layer are: ARP, RARP, DCAP.
The Datalink layer is subdivided into two other sublayers, the Media Access Control (MAC) and the Logical Link Control (LLC). The figure below illustrates this:
Media Access Control (MAC) 802.3
This defines how packets are placed on the media (cable). Contention media (Ethernet) access is first come first served access where everyone shares the same bandwidth. Physical addressing is defined here. What's Physical addressing? It's simple.
You will come across 2 addressing terms, 1)Logical addressing 2)Physical addressing.
Logical addressing is basically the address which is given by software e.g IP address.When you get an IP address, this is considered a "logical address" which is provided to you after your TCP/IP stack is loaded.
Physical addressing is an address which is given not by the software, but the hardware. Every network card has a "MAC" address which is burnt into the card's eprom (a special memory chip) and this special address is used to uniquely identify your computer's network card from all the others on the network.
There is a whole page dedicated to MAC Addressing if you would like to read more about it.
Logical Link Control (LLC) 802.2
This sublayer is responsible for identifying Network layer protocols and then encapsulating them when they are about to be transmitted onto the network or decapsulate them when it receives a packet from the network and pass it onto the layer above it, which is the Network layer. An LLC header tells the Datalink layer what to do with a packet once a frame is received. For example, a host (computer) will receive a frame and then look in the LLC header to understand that the packet is destined for the IP protocol at the Network layer. The LLC can also provide flow control and sequencing of control bits.
If you are finding all this a bit too difficult to understand, I suggest that you read more on the OSI model and check the Data Encapsulation - Decapsulation page which explains how the data travels up and down the OSI model and shows how each layer adds or removes its header information depending on the direction of the data.