A patent is a basic contract between the public (acting as the government) and the inventor. The inventor fully discloses his trade secret in exchange for a limited right.
From a practical standpoint, patents are a huge bargain for a government. Hundreds of thousands of patents are filed each year, each containing (what the inventor thought was) the latest improvement in technology. A vast number of these inventions sit unused with little commercial value. Only a few of them are actually licensed, and a very smaller number are litigated. In the long run, trillions and trillions of dollars worth of research is made accessible to the public which cost the public mere billions in licensing/litigation costs.
The saddest part is that the public does not take advantage of this tremendous resource. I think there is an untapped gold mine in the patent system that is tremendously commercially useful.
Many companies are petrified to do patent searches for fear of finding a patent that they may infringe, making them vulnerable to triple damages. Others are merely ignorant of the fact that patents are intended to be used as fodder for starting further research. Why reinvent the wheel, when you can invent an improvement on whatever has been done before?