Bars are vertical lines that are on the stave. Typically they are after 4 beats (4 crotchets) but they can be any length, this is predetermined by the time signature (see time signature section). They are also known as measures.
There are many types of lines that show the end of a bar. The most common one is a single bar line (also known as normal), this just simply shows the bar ending. Another common one is the final bar line, this is always found at the end of the music only. The third most common bar line is the double bar line. This usually shows significant changes in the music such as a a key change, tempo change or a change in structure.
Here are two bars of music. It is in 4/4 (also known as common time, with the symbol that looks like a C). We also know it is in 4/4 because there are 4 crotchet beats in a bar and each beat is shown by the red arrow.
Here is the piano part for Lovely Day by Bill Withers. You can see there is a double bar line at the end of bars 9, 16, 24 and 32.
The double bar lines help the player to see the different sections of the song (intro, verse, prechorus and chorus). Without the double bar lines, the piano player may get confused with which section is which.
Bars and bar lines are very good because without them, the music would just be one long bar, and it would be quite hard to play the correct rhythm, and you wouldn't be able to know the first beat of the bar without bar lines. This would mean that the player would struggle to phrase the music properly and to play it it in its corect sentance structure. You wouldn't be able to place the strong beats (1 and 3) and it wouldn't sound rhythmical.