Sometimes an ATM will run out of money however most times ATM machines are filled up often enough to keep the money from running out.
Most larger ATM machines hold enough money to last for a few days to even a month and the ATM machines are usually regularly checked to ensure the money is in the ATM machine to avoid inconveniencing people.
If the ATM is at a bank then it will usually be filled more often to keep from running out but an ATM machine at a convenience store or other location may not get filled as often.