What part of speech is “there” when used in “There is (blah blah)”?
It depends who you want to satisfy with your classification. If you must classify into the traditional eight parts of speech, there is considered a pronoun (Dictionary.com - see below), specifically a dummy subject (Wikipedia), usually termed "existential there" 1,2,3 - search term in Google Books.
there
pronoun
7. (used to introduce a sentence or clause in which the verb comes before its subject or has no complement): There is no hope.
In the phrase "there is" there is grammatically unnecessary, but it has two uses. One, not to end an existential sentence with a being verb. For instance, see this dissertation, page 63 (though read Chapter IV, pp. 53-115 if you're really interested):
For example, King Alfred could write “swae feawa hiora waeron” (so few of them were), but to translate this into more modern English, we need to supply a subject slot filler as in “so few of them there were” or more naturally “there were so few of them.”
The other use, as in your example, is to emphasize the existence of the subject. So "A book is on the table" is perfectly fine, but the existence of the book is underlined in the sentence "There is a book on the table." (That's why "there" is termed existential - it's only used in existential clauses.)
However, classifying "there" as a pronoun is controversial since a pronoun is defined as a substitute for a noun. There is not a substitute for a more specific noun. Along these lines, in the 8-part scheme, you should logically call it a noun. I haven't found a source to back this up, though, except for the definition of a noun.
But since even a noun must refer to an entity, and there does not, existential there is not either a noun or a pronoun.
If you're still interested, you probably don't mind transcending the artificial part-of-speech system. In fact, the reason I can't find a direct refutation of there as pronoun is that every scholarly work I've come across does not refer to eight-parts-of-speech period. So, after getting rid of the clutter, there doesn't have to be classified with either nouns or pronouns. It's existential there. It's a dummy subject. But it's not a pronoun.
Because really, you can't group it with any other word and call it a homogeneous category. It even presents differences from the dummy it.
As to the punctuation problem, put the question mark outside of the quotes, and you'll be fine:
What part of speech is there in the sentence "There is a book on the table"?