The best way to protect your invention is to obtain a patent for it. A patent is a government granted monopoly which allows you, the inventor, to exclude anyone else from making, using or selling the invention claimed in the patent in the country that issued the patent. However, it is your responsibility, not the government's, to enforce the patent.
Once a patent expires, your invention will be in the "public domain". That means that anyone else can make, use or sell your invention without needing your permission or paying you anything. In the United States, patents are valid from the date of issuance until 20 years from the date of filing the patent application. There are some countries which issue patents with terms of other than 20 years but you can generally expect that patents will last for 10-25 years in most of the world.
There are two important limitations to patents. First, the definition of a patent is a government granted monopoly which allows you, the inventor, to exclude anyone else from making, using or selling the invention claimed in the patent in the country that issued the patent. A completely valid, in force, United States patent is enforceable only in the United States. Anyone else is free to use and sell your invention in any country in which you do not have a patent. Second is that your patent covers everything in the "Claim." Your patent's claims define the scope of the patent's protection; it is the most important part of the patent.