The use of the definite article (the) implies that the number is known or can be reasonably estimated. The number of students in my class increases each year. (I'm not giving you the exact number, but I could if you asked)
The use of the indefinite article (a) implies that the number isn't known or isn't critical information. A number of students were in the hall when the bell rang. I could replace a number of with some without changing the meaning of the sentence.