The money that gets paid to the patent office when filing for a patent mostly goes to keep the patent office going.
The patent office is not really a for profit business, they just make you pay fees when you file stuff with them to cover the cost of the work they are doing. Bureaucracy costs money and rather than making the average tax-payer pay for it they charge the people who directly benefit from it.
You can see what the US Patent Office charges here:
https://www.uspto.gov/learning-and-resources/fees-and-payment/uspto-fee-schedule
You can also see what their budget is here:
https://www.commerce.gov/sites/default/files/2022-03/FY2023-USPTO-Congressional-Budget-Submission.pdf
The have some money over after paying of everything, but they also need to keep some money in reserve to cover next years expenses in case they take in less in fees.
It mostly pays for operating the patent office.
Patent offices don’t collect anywhere as near as trillions of dollars. For example, the [US patent office’s budget for 2023](https://www.commerce.gov/sites/default/files/2022-03/FY2023-USPTO-Congressional-Budget-Submission.pdf) estimates $4.25 billion in collected fees, and $4.15 billion in spending. The rest of the revenue is reserved.
It’s rare for an individual products to be patented.
For example, take the laptop in front of me. That laptop will have all sorts of patented technology in it. The bluetooth I’m sure is patented, USB and HDMI might well be, and there will be patents relating to the processor, screen, motherboard, etc..
But none of those patents will be unique to this particular laptop. They’ll all – like bluetooth – be technologies used across many different products.
In terms of numbers, it looks like there are about 300-350,000 patents filed in the US annual, and filing them costs about $500-1000 in revenue. So that’s somewhere between $150-350 in revenue annually. And the system itself will cost money to run – doing the admin, making sure patents are legitimate, etc..
If you invent something new, you can patent it (most of the time). In order to do so, you pay a fee to the government (the patent office), who then check if it is really your invention, if it is a new invention, if something like it already has been patented, if it is relevant enough to be patented,…
Once you hold the patent, no one is allowed to use your invention without your permission. Which either means no one else can use it (for example Lego up until recently), or you charge a fee to anyone who wants to use your patent.
This fee is essentially your profit from inventing the thing in the first place, since R&D takes a lot of resources.
The money for patents mostly goes to two places. Government administration to cover the costs of filing, and on legal professionals like lawyers who charge money for the service of registering intellectual property including trademarks, copyrights and patents. Therefore, to answer your question, the money goes primarily to law firms specialising in IP.
Patent fees cover the costs of running the patent office… a patent typically costs a few thousand dollars in fees to the USPTO. And that fee covers all the administration, research, legal work, etc. that has to happen to grant the patent.
Not every product has a patent… many just re-use existing patents, or don’t have patentable advances.
Latest Answers