Hi,
If the underlay is delaminated in anyway (crumbly/powdery/flat) then it needs replacing, likewise if it has been down many many years.
You cant clean underlay and why would you want to? It cant been seen....
If the reason your asking the question is because something has gone through to it and soaked it ie urine, etc. it needs replacing because on hot days the smell will penetrate through the carpet and stink the room out. If its tea or coffee just let it dry out, it will stain but so what