The Aeneid was written between 29 and 19 BC, in the last eleven years of Virgil's life, at the beginning of Augustus's rule. Virgil died in 19 BC without considering the poem finished, and it was published only after the poet's death, by order of Augustus.
The ancient biography of Virgil, written by Suetonius and preserved by Donatus, tells how the work was done. Virgil first wrote the whole poem in prose, already divided into twelve books, and then turned it into verse out of order, choosing each day the passage that pleased him. So as not to lose momentum, he left parts incomplete and put in provisional lines, which he called props, to wait for the final ones.
In 19 BC he set out for Greece, determined to spend three years revising the text, fell ill on the journey, and died at Brundisium on the way back. He had asked that the Aeneid be burned if anything happened to him. Augustus would not allow it: he ordered the poet's friends, Varius and Tucca, to revise the text, and Varius published it corrected only lightly, with the unfinished lines as they were. That is why the poem we read has lines that stop in the middle of the verse.