Rhythm is a word that has many meanings in music. This can be the source of unnecessary confusion for students when they first begin, you may have heard the words time and tempo used in the same way. Let's break this down into the essential elements. tempo is like a river. Think of a river for a moment. It usually flows at a constant pace, but it's not rigid or mechanical.
When humans make music, it is a goal to be as consistent as possible with the tempo. But in reality, it's alive and it has subtle shifts like the flow of a river. Rhythm is how we interact with the flow of this river. Imagine sticking your hand in the flow of the river for one second and then pulling it back out. Then imagine doing the same thing for two seconds and half a second. This is the equivalent to playing notes of different lengths.
The river is constant, but how long we play the notes for is what makes it into music. Rhythm is the most mathematical part of music education. But fear not, there is nothing more advanced than simple addition and subtraction involved. Imagine your favorite type of pie for a moment. Now the size of the pie is constant no matter how we slice, the pie represents a bar of music. If you eat the whole pie yourself, it's like playing a whole note, which takes up the entire bar.
If you invite a friend over and cut the pie in to have two half notes, you cut it again, you have four quarters, cut it again and you have eight eight. In music all time has to be accounted for. Again, think of the pie. If you have a pie and you cut it into four quarters, and you only want to eat one of the quarters. The other three quarters still exists because the whole pie was bait. This is the same in music.
So wherever there Not a note played there has to be a rest to take its place. So each of the note values and music, of whole half quarter eighths and so on. All have rests that lasts for the same amount of time.