Yes shampoo does have a shelf life and usually the shampoo is good for at least a few years past it's expiration date.
The shampoo will still be okay to use after it's expiration date but the shampoo will not be as good at cleaning your hair as fresh non expired shampoo would be.
When shampoo expires it will usually smell bad such as smelling like wet dog or mushrooms then it's likely bad and probably best to throw it out and not put it in your hair.
The shampoo could make your hair smell bad.
Also runny liquid looking shampoo usually means it's bad and no longer very effective at cleaning your hair.