http://www.aish.com/sp/k/48951781.html
...For the sake of creation, the sparks which began on a very high spiritual level were sent down to the lowest of spiritual levels, a place of great spiritual impurity. To make creation, God drew out exactly as many sparks as He deemed necessary to make creation, and left the remainder for man to utilize as a partner in perfecting creation.
There is not an infinite amount of Holy Sparks in creation. In fact, history is measured by these sparks, and will come to a close when all sparks have been drawn out of the tohu and returned to their holy source Above. It is then — once all the sparks that God has made available to mankind are expended — that by definition the Messianic Period must begin.
How does one use up Holy Sparks? Through the learning of Torah and the performance of mitzvot, Holy Sparks are redeemed, purified, and ascend to Above. Indeed, transgressions also use up Holy Sparks, but in the process the sparks themselves become defiled and require “cleansing” before being able to ascend. The cleansing process comes in the form of either sincere repentance by the transgressor, or through Heavenly-ordained suffering...
Thank you, jjotto!