I heard 15 lines was the number at one point, but it is certai ly more now.
In short, the range of the instruments expanded, so the staff had to expand with it.
One way to look at the staff is like this (keeping in mind the history)
The first ledger line below the treble clef is the same note the first ledger line above the bass clef. Think of this as where the staff once met but with the middle line ‘rubbed out’ and replaced by a ledger line.
This is called middle C and is the middle note on the piano. If you write this out, you can see that the notes are just a continuation in each direction.
Although the staff came before the piano, I have a sneaking suspicion that the use of clefs particularly treb and bass came from splitting the piano down the middle.
Because some instruments are capable of lower notes than the bass clef, u use the appropriate number ledge lines below. Same for the treble clef. The top notes on the piano for example extend higher than the clef and you need to use ledger lines.
Instruments evolved and started to use different ranges, so other clefs came to be in use, only to make it easier for those Musicans to read on their instrument. Their are treble, alto, soprano, tennot and other clefs! Remember that in the beginning, we were talking about the range of the human voice, because music performed in the church was choir based.
If a wiz bang new instrument came along, exceeding previusly known ranges, the ledger lines would have to be extended, or someone might create a new clef.
But we are to an extent limited by the natural hearing range and what is common/useful for the purpose of music making.