How does the US know whether you have overstayed your tourist visa without having an exit stamp on your passport? How is it really calculated?
They don't. The US does not know how many people have overstayed their visas. This implies that in any individual case, the US can't be sure whether a person has complied with visa terms.
As others have mentioned, the US tracks exits by gathering data from the airlines and other carriers. However, because the US doesn't have exit controls, the system can easily be defeated. See, for example, the New York Times article U.S. Doesn’t Know How Many Foreign Visitors Overstay Visas.
A visitor to the US could fool the system by checking in for an international flight (for example, to London) and then swapping boarding passes with someone on a domestic flight (for example, to Chicago). The visitor then flies to Chicago, and the confederate flies to London. The US government believes that the vistor has left the country, but in fact, the visitor is in Chicago.
The US uses what they call a "biographical entry/exit system," which means that your biographical data (passport information) is tracked to determine when visitors enter and exit the country.
Entrance data is collected by immigration officers at points of entry, but as you note, the US has no exit controls, so where do they get exit data? Generally from airlines and the Canadian and Mexican authorities. The system is not perfect: there are some ways in which people leaving through Mexico aren't properly tracked, and sometimes there are data mismatches when people enter and exit on different passports.
Sometimes, if the system has gone wrong, the US will accuse you of overstaying when you haven't. In this case, you will want to carry proof that you did depart on time: plane tickets, passport stamps from other countries (you can always request a stamp from Canadian or Mexican officials), etc...
If you think that your arrival/departure records may be incorrect, you can check them online at https://i94.cbp.dhs.gov/I94.
The airlines will tell them.
Remember in the good old days of the green I-94W forms (this might actually still happen today for some countries?), they used to staple a part of the form in your passport? The check-in agent was then supposed to collect that part of the form, and it was supposed to be used by INS to check for overstayers (and more), though it probably wasn't always very accurate.
Nowadays this is just sent directly from the airlines computer systems. Whether it actually works is another matter.