Index funds are market cap weighted. As companies fail, as they always do (median lifespan of S&P companies is about 15 years), you have less of it.
And then when you sell your units, hopefully in aggregate the index is worth more than it was when you entered...