Phantom,
There are two points of view.
The first argument is that in the sentence (There are a book and two pencils.) multiple subjects require a plural verb.
If you turn the sentence around: A book and two pencils are there....then you see that multiple subjects require a plural verb.
The second argument is that the sentence has no real subject therefore—
There is a book and two pencils. = There is a book [and there are ] two pencils.
or
There are two pencils and a book = There are two pencils and [there is a book.]
In this case the verb agrees with the noun that immediately follows it in the sentence. The majority of writers prefer this form.
Both forms are in current use and both are acceptable.
Although in formal writing the variation that is more likely to be considered correct is:
There are a book and two pencils.