Pregnancy test?

Hoping someone can clear this up for me: I know that pregnancy tests have time frames and that they are invalid after a certain amount of time, but why? Why would it sitting longer cause a line to appear in the test? Just curious honestly, hope someone can explain! Thanks ladies!