An unsuccessful payment (in the vast majority of cases) is returned to the sender immediately. In very rare cases, a payment gets stuck and is returned to the sender in some (20-80) blocks, depending on settings.
Many payment failures go completely undetected since payments are attempted iteratively through a trial and error process until success or the timeout.
Failures primarily cost time.