I was preparing a grammar exercise from a book, and I came across the sentence "there were a huge number of mosquitoes." The sentence was not actually testing the number of the verb, but I stumbled over it, as I would spontaneously say "there was a huge number of mosquitoes." But I also noticed that I would say "a huge number of mosquitoes were there."

So I spent a few minutes digging around in grammar books and found several confirmations of the latter point ("number of" + plural verb) but no discussion of the number of the verb in such a construction with "there." So there's always a nice Google test:

"there were a huge number of" = 381k hits
"there was a huge number of" = 15.5m hits

You can't always count on Google to do your linguistic research for you, but this one seems pretty clear! Over 40:1 in favor of the singular "was" here, even though the reverse is true without "there" (though only just under 9:1):

"a huge number of people were" = 1.36m hits
"a huge number of people was" = 156k hits

Take out "huge" and the ratio is over 100:1 in favor "there was a number of", but about 20:1 in favor of "a number of people were."

So the descriptive conclusion is that in contemporary English, "number of" usually takes a plural verb, but "there X a number of" usually has a singular verb.

(Just trying my hand at a little linguistics.)

There was / were a huge number