The idea is to be countercyclical. Cut spending and increase taxes during a boom, cut taxes and increase spending during a bust. Keeps inflation during boom and deflation during a bust from being too high. The idea is to keep the boom from burning itself out (prevent leading to a crash) and to shorten the depth and duration of a bust (and eliminate them if possible).
Keynes did point out that poor people are more likely to spend money they receive than the rich, so if you’re trying to get out of a demand-caused bust, dollar per dollar, redistributing to the poor is more effective. During a bust, the rich especially have a liquidity preference so they’ll hoard cash instead of spending it.