A common way to secure a patent is to file a provisional patent application with the USPTO. A provisional patent application is essentially a preliminary, summary version of a final patent application. USPTO will not issue a patent based on the provisional application, but filing for the provisional application does give you certain rights related to the patent that may issue at a future date. For instance, if you file a provisional patent application, while the application is pending you can claim "patent pending" on your idea or product, and if anyone violates the patent during the patent pending period you will have the right to sue them at the time you acquire the final patent. A provisional patent application, then, is a temporary and conditional way to immediately secure the benefits of a future patent.
To obtain a final, official patent from USPTO, you can either convert a provisional patent application into a final patent application, or file a final patent application even if you never filed a preliminary application. If your patent application reveals a genuinely novel and useful invention or idea, the patent and trademark office will issue you a patent. The final patent application process typically takes 18 months or more.
If the idea or product you want to use is the subject of an existing patent, you can secure the use of the patent by negotiating a license agreement with the patent holder. Under the license agreement, the patent holder will give you either the exclusive or nonexclusive right to use the patented idea or product. That license agreement can give you all the same rights that you would have if you had secured the patent from USPTO yourself.
A final way to secure a patent is to purchase the patent from the current patent holder. A patent is basically a type of personal property, which means the owner of the patent can sell it at any time. If you want total control over a specific idea or invention that is already patented, the purchase agreement is the only way to exclusively secure the patent on that idea or invention. A purchase agreement makes you the new holder of the patent, while a license agreement simply gives you the right to use the patent according to the specific terms and conditions set forth by the existing patent holder.