Generally speaking, their inheritors keep the funds in the market. If the Boomer has a significant amount in their 401K, a fiduciary is just going to tell the next of kin to keep it market, and most people fill out a Time of Death Beneficiary so the account just transfers over to their heirs. Unless they're in heavy debt or need a down-payment on a house, most people will just keep the account.
I highly disagree in the sense of most people. Everyone I have known in the situation have put it towards a house or it was so low they just took the cash for bills. I think most will keep it in investments if its quite substantial maybe but many people die having already had to sell off assets and reverse morgages and all kinds of things.
I mean, if the payout is so low that it's not worth keeping in the market, then it's not going to have much of an impact on the S&P 500. I'm sure many Millennials (focusing on them, since they're most likely to lose parents) will use the money for a down-payment on a home, but 52% of them already own homes, and many Boomers will be leaving behind their own homes, so it's safe to say substantially less than half of them will need to cash out their parents 401Ks for homes. Student loans will probably take up some of that money, but the average student loan debt is $32K, while the average boomer has about 200K in retirement savings, so even the student debt crisis isn't going to take that much money out of the market.
The real thing to watch is medical costs. Boomers are living longer while medical costs are skyrocketing, so it does seem that a lot of the wealth the Boomers accumulated is going to medical industry instead of Millennials. I don't know hoe that's going to impact the market though.
I would guess if anything rich people dying is good for the economy. Retired people are generally sitting on their assets in the form of homes they're not going to sell until they kick the can and retirement accounts in low risk investments. When they bite the dust all of those assets get swept into taxes and to their kids, who probably spend it or at least invest it in the market in a way that is more stimulating than what their parents were doing with it. Old people are stagnant and safe with their wealth which is not good for line goes up.