Law of total tricks is an empirical law which states the following:
If opponents play the contract with their best suit (with A cards) as trumps, and they can make x tricks, and you play the contract in your best suit (with B cards) as trumps and you can make y tricks, then A + B = x + y.
This was first proposed by Jean-Verne Rene in a bridge world article and made popular by Larry Cohen in his book: "To Bid or not to Bid: The Law of Total Tricks."
The purpose of the law is to decide whether to play or defend and the level to play, when both sides are bidding, i.e. it is more useful in competitive auctions. Trying to apply it in constructive auctions (where opponents haven't bid) does not make much sense. (Of course, when you are raising partner with a weak hand, as a preempt, you are kind of using the law in advance).
As a simple example: Say you hold xx, Kxxx, QJx, Txxx, playing IMPS, non-vul.
Suppose partner opens 1 Heart (showing 5+ cards), RHO overcalls 1 Spade. You bid 2 Hearts and LHO bids 2S, which is passed around to you.
Now assuming opponents have 8 spades between them, if you assume the law, then there are 8+9 = 17 total tricks.
- Now suppose 2S is making exactly. Then by the law, it means you can make 3H.
- Now suppose 2S is making 9 tricks. Then by the law, 3H is at most down 1.
- Now suppose 2S is down 1. Then by the law, you make 10 tricks in hearts!
In all cases, you are better off bidding 3H (even if doubled, non-vul) as opposed to letting them play in 2S.
Of course the law is based on empirical evidence, and there are many adjustments that need to be made, which you can find in Larry Cohen's book.
On the flip-side, there is a book by Mike Lawrence: I Fought the Law of Total Tricks which says that the law might actually not be as useful as people think.