So the first step is where the federal reserve is faced with the fact that Keynesian stimulus is failing, specifically monetary policy only affects inflation and prices and not real economic growth. Egos and heads explode at the fed because they're "economic geniuses" so they can't be wrong! So they lie to themselves and say they just "didn't do enough of it" and go onto fire up the printing presses.
But what to do with the money? They don't want to cause "inflation" but they still want to "boost the economy." So what they do is buy US treasury bonds, sometimes directly from the US treasury, but other times from banks and other financial institutions that are looking to get rid of that paper. But it's not just US treasuries they sell to the
The proceeds of these purchases go into the coffers of the commercial bank and other financial institutions that sold those
Why they invest it in the stock market!
And yes, it really is that simple junior, deputy, aspiring, official and otherwise economists!
Of course the increase in stock prices is not considered "real inflation" because...well...fed economists said so. So you go right ahead and max out your 401k contribution buying overpriced stocks with a PE of 27 and a dividend yield of 2%! It's patriotic!