Lifespan

A lifespan (寿命, jumyou) is the amount of time that an individual will live for. It also refers to the date (in Shinigami time) visible above a person's head with the Shinigami Eyes. When the date is reached, that person's lifespan is over and they will die.

Appearance
With Shinigami Eyes, the lifespan of a human is visible as written numbers floating above the human's head, as well as the human's name. This lifespan will, however, not change in appearance if altered by use of a Death Note in the human world and will always show the human's primary lifespan.

Shinigami do not have the power to view the lifespans of other Shinigami. Likewise, humans with Shinigami eyes cannot see the lifespans of Shinigami or the owners of Death Notes.

Purpose
Shinigami use Death Notes to kill humans so they can inherit the remaining lifespan from the human they killed. To know how many years they are taking, they need to be able to see the human's lifespan. Shinigami continue their existence by taking years from humans in this manner.

Unlike Shinigami, humans do not inherit other humans' lifespans after killing victims with a Death Note. However, they can have their lifespan extended if a Shinigami sacrifices itself for a human they favor. At different points, Rem and Gelus do this to extend Misa Amane's life, both dying in the process

Lifespan trade
A human can exchange half of their remaining lifespan in order receive the power of having Shinigami Eyes. This is done by the human agreeing to the Shinigami Eye Deal.

Conception
Tsugumi Ohba says "I did create a complicated math equation for Light's Life span when the numbers first appeared above his head. But now I don't even remember the formula. Every other life span number after that was added by Obata-sensei. He chose some nice numbers." In the Japanese, Ohba notes that Light's formula used binary.

Trivia

 * As the Rules of the Death Note state, Shinigami cannot take the lifespan of a human unless they are at least three years of age; newborn deaths aren't their doing/fault. They also cannot take the lifespan of someone over 124 years old.
 * As Shinigami can tell when someone will die, the moment fate changes to extend or shorten it they will see the lifespan change; hence why Ryuk cracked up laughing when Light tricked Naomi Misora.