According to the US Patent and Trademark office, a patent is "a property right granted by the US Government to an inventor to exclude others from making, using, offering for sale, or selling the invention throughout the United States or importing the invention into the United States for a limited time in exchange for public disclosure of the invention when the patent is granted." A patent is often referred to as a "negative" monopoly because it allows the patent owner to prevent others from practicing the invention.
This right to "exclude" generally lasts about 17-18 years.
In exchange for that monopoly, the invention enters the public record - including figures, an explanation (called a "specification" in patent-speak), and a series of "claims" defining the limits of its exclusivity - so that the world at large can learn from it. The claims are found at the end of the patent - and are sometimes compared to the metes and bounds given for a parcel of land because they describe the boundaries of what is protected by the patent as the property of the patent owner. And just like owning a piece of real property may be subject to zoning laws, easements or other laws that restrict the use of that property, some patented inventions cannot be practiced because they would infringe on other patents.
To qualify for a patent, an invention must be novel, non-obvious, and useful. And that’s where "prior art" comes in.