Any decent accounting system can generate invoices and track receivables. Typically an invoice has payment terms: net 30, net 60, etc. The date of the invoice plus the grace days (e.g. 30 for net 30) gives a due date. Many companies work on monthly billing and receivables cycles so you see the 30/60/90 periods a lot. Receivables reports generally show aged receivables, amounts in current (not due yet)/30/60/90+ buckets. And receivables reports also generally show individual outstanding invoices, and delinquent (overdue) invoices.

Accounting systems usually have a way to prod or "dun" the payee, with emails or (in the old days and maybe still) letters. The dunning notices can get more insistent as the invoice gets older. And generally the accountant or AR manager has a report showing the overdue receivables with notes on calls and emails and promises made for payment.

At some point a portion of receivables may turn into legal problems. You probably can't predict (the proactive part of your question) which, but over time you may have some criteria for extending credit (banks and credit card companies use FICO scores and credit reports, similar databases exist for business credit ratings). What you can do, both legally and practically, to collect a debt depends on the business, the contract, and state and local laws. Usually small amounts get written off (probably deductible on your taxes) and large amounts get turned into a lawsuit. How that works and plays out depends on the jurisdiction of the parties. Most US states have mandatory or strongly-encouraged mediation and/or fast-track small claims court for amounts under some threshold, maybe as much as $20,000. That part you would not trust to software -- collection plays out case-by-case and you have to weigh the legal costs and antagonizing or losing a customer who may eventually pay, or settle.

Ideally you don't get yourself into the position where customers can run up large amounts of receivables (debt to you) but in some businesses you can't avoid it.

My observations from a 40+ years career that included writing several accounting and receivables systems, and getting chummy with lawyers and the accounting people who write checks:

- Most people and companies pay their bills on time or reasonably close to on time.

- It only takes a few slow- or no-pay customers to seriously hit your cash flow.

- A large organization or government agency that owes you a lot of money but stalls on paying can kill you. Even if you try to collect you can get forced into a full-blown lawsuit that drags on for years, against an organization that has full-time legal resources. Large amounts don't go to mediation or small claims, so you end up in the court system litigating a breach of contract suit.

- Smaller companies very often get involved in expensive collection or contract suits over small amounts of money they would be better off just writing down and moving on. It turns into a battle of egos with only the lawyers profiting in the end. I see that a lot with software development firms and their clients -- spending a lot of time suing over a few thousand dollars.

- Just like in a casino, figure out in advance how much you can lose without creating a financial disaster, and don't extend credit over that amount. Ask for deposits, escrow, or up-front payment.

- If a customer or client seems shady or asks for a lot of accommodation (like extended terms without a good explanation), or they give you a bad feeling, don't let them get in the position of owing you a lot of money.

- Vet your customers/clients if you can. Use a credit reporting agency and adjust the receivables limit based on the customer's history and reputation.