Pattern repeats on the 8th note, called the octave.
The purpose of music notation is to represent some of the notes, or a range of notes, not every note possible.
Any voice or instrument has a set number of pitches it may sound; this is the range.
A bass cannot sing as high as a soprano and vice versa.
Range may also be used generally to refer to any set of notes; specifically indicating from the lowest pitch to the highest pitch of any group.
5 lines/4 spaces were not always standardized. Here we have a piece of early music that uses 4 lines.
Centuries ago, 5 lines/4 spaces had become the standard as it is legible and may represent the range of most instruments and voices.
The 5 lines and 4 spaces themselves have no meaning without a clef. Like any graph, the staff needs labels to carry specific meaning.
The clef's purpose is to label one of the 5 lines to represent an orientation note; since music has a set pattern, once one line is labeled, the values of the other lines and spaces are easily recognized.
Clefs show what range of music we are trying to represent.
Notice how each focuses on a different octave:
Bass: A=110 - A=220
Alto: A=220 to A=440
Soprano: A=440 to A=880
Each clef labels an orientation note on one of the 5 lines of the music staff.