Does the company have a responsibility to reinvest all of it? Can a company have a lot of money just sitting around? Is that grounds for shareholders to sue? If a company has a lot of money just sitting around, can they opt to give a portion of it to shareholders as a one-time thing?
It doesn't go anywhere. It stays in the company as undistributed profit.
If the company has too much cash and no opportunities to invest it in further growth, it can be harmful to the company's return on equity.
Therefore typically the company will sooner or later choose to distribute it to shareholders either in the form of (regular or extraordinary) dividends or share buybacks.
If enough shareholders are unhappy with the company's dividend policy or the way the company is managed, they can vote to change the management at the shareholder meeting.
They may keep the cash sitting in a bank somewhere as a cash reserve. They may invest it in stocks or bonds in other companies or in government units. They may invest in new factories or equipment. They may pay down debt. Etc.
Do they have a "responsibility" to do anything in particular with it? In a sense. A corporation has a legal, fiduciary responsibility to the shareholders. If they are using money unwisely, yes, shareholders could sue the board of directors. Of the top of my head I don't know of any cases where shareholders sued because a company kept too large a cash reserve. I'd guess that would be a tough case to win because it's so subjective. Usually to win a shareholder suit you have to claim that management is doing something unethical or criminal, I think.
To add to other answers... If the company is publicly traded, there is another good reason why keeping large amounts of money sat in the bank is a bad idea, and shareholders may consider this a harmful strategy by the board.
A competitor may try to buy enough shares to gain control over the board and force a takeover. So far, so normal. However, if the competitor knows that the company has a large amount of money in the bank, they can take out loans for much larger sums (or invest more of their own money) in the knowledge that this will be paid back when they get control of the company and the cash reserves sat in the company bank account. Essentially, they can finance the company takeover with the company's own money.
If the board is leaving the company open to this kind of tactic, shareholders who want to keep control of the company as-is should be very concerned.