Patents exist as incentive for inventors to reveal the workings of their inventions; to receive a patent, you must provide the patent office with a functional description of your invention, which is then published. Even though others may not copy your invention during the patent period, they can study your patent filings and use them to figure out how to do the same thing in different ways, or how to make an interoperable add-on to your invention.
Source: wiktionary