If I am found guilty of a software patent infringement how does the court determine how much damage is done and how much I should pay?
The recent $1 billion verdict in Apple v. Samsung offers a contrast to ordinary patent infringement damages. In that case, a number of Apple's patents were "design patent." Design patents protection ornamentation (i.e., the interesting shape) of a device rather than technological development that is the province of utility patents.
By quirk of history, the design patent law allows a patentee to recover a defendant's profits. This law is codified at 35 U.S.C. 289 reproduced below. Thus, in that case, the jury looked to see how much the infringer (Samsung) had made in profits on the infringing devices and then awarded that to Apple.
In the case of technology (utility) patents, the patentee may be able to prove its own lost profits caused by the infringement. However, in the vast majority of cases courts (would) rule that lost profit calculations are too speculative and thus the patentee must fall back on proving what would have been a "reasonable royalty." To calculate a reasonable royalty, the jury is supposed to walk through a "hypothetical negotiation" between the patentee and the infringer and predict, at the time when infringement began, what would have been a reasonable payment at that time for a license?
Damages calculations is extremely inexact. However, in recent years courts have been pushing parties to provide better evidentiary support to prove their case.
First, the law (35 U.S.C. 284):
In practical terms, "damages adequate to compensate for the infringement" are lost sales; that is, but for the infringement, how much money would the plaintiff have made? As you can imagine, this can get very bogged down in numbers, but some factors can include: how many sales the infringer had, whether the plaintiff could have produced enough product to capture those sales himself, whether the infringement affected the price the plaintiff could charge for his own product, whether the patented features have a significant effect on the market position of the product, whether other reasons unrelated to infringement limited the commercial success of the plaintiff, etc.
The alternative, a "reasonable royalty," is also a bit of divination, but it can be based on what I feel are less speculative factors, such as: what are common licensing royalties paid in the industry; how much of the product is based on the patented technology; how well would the product perform without the patented technology? This is also the more useful damage calculation for non-practicing entities (i.e., "patent trolls"), as their lost profits are, by definition, zero.
Then the willfulness factor is examined. That is, if you knew or should have known that you were infringing a patent, damages can be 3x.