It depends entirely on the issuing authority who decides what to do with passport numbers.
In countries with a high rate of fraud, immigration (outbound) I find that passport numbers change with each renewal.
Passport numbers may also change as a consequence of changing internal requirements for passports. Many countries are moving to "digital" identity cards (such cards have information embedded in an EMV chip); this migration sometimes necessitates changing the numbering system for other id formats as well.
As mentioned in the comments, if you reach the age of majority your passport number (and other id numbers) also can change - this is true for a few countries that I am aware of (including Australia - thanks to The Wandering Coder).
If you get married, sometimes your national id number or family sequence changes, this results in a change for all your (eventual) dependents and thus their documents also have to be updated.
Sometimes, it is just a matter of preventing older passports from being used again (as a measure of fraud prevention). For example my passport number has always changed and over the years even the format and length/number of digits and characters.
My very first passport had one letter and 6 numbers; and there was no booklet number. It included my height and profession, had labels in three languages, and was written by hand. It also had the passport number punched through each page.
My latest passport has two letters 8 numbers, a booklet number (which is punched through), no longer includes my height or profession, is printed and laminated and the numbers are in sequence (comparing the latest and the previous one); although this might just be a coincidence.