A patent is a document issued upon application by a government office or a regional office acting for several countries which describes an invention and creates a legal situation in which the patented invention can normally only be exploited ( manufactured, used, sold, imported) with the authorization of the owner of the patent ( WIPO Intellectual Property Hand Book, 2004)
Invention means a solution to a specific problem in the field of technology. So an invention may relate to a product or a process and a patent is usually protected for 20 years.
So when you come up with an invention and patent it with a government office, you gain an exclusive right to exclude others or even the competitors from using your technology without your consent. In other words, a patent gives you a competitive advantage to monopolize the market.
It also generates revenue through licensing whoever wants to use your technology.