Here's what you'll go through when getting a patent:
1. Work on your invention. This is when you try to get your invention working. It's pretty much your Research and Development time. As you go through this process, be sure to keep your inventor's logbook so you'll be able to trace your progress. It also helps you when filing for your patent application (see the Inventor's Logbook article on this site).
2. Write down a description of your invention; including what you think is new and innovative about it. This is where you try to concretely describe your invention. In my experience, this can actually be very difficult to do. You may think you understand your invention intuitively (after all, you've been working on it for so long), but being able to write about it objectively can be very hard. But it is important to do so, because this makes you consciously identify the key features of your invention, and how it is different from all the other prior art in the world.
3. Do a prior art search. Next, you'll need to search the prior art to see what other people have already invented. If someone else has already invented or patented your invention, then this is pretty much the end of the road for your patent hopes. But if your invention hasn't already been invented, then you can go ahead with the (potentially expensive) patent application process. However, more often than not, you'll find that other people may have already invented similar but not identical things. In this case, you'll need to describe very clearly in your patent application how your invention is different from theirs. Otherwise the patent examiner may think you are trying to patent something that already exists.
4. Prepare your patent application. The next step is to prepare your patent application. You can either do this yourself, or hire a patent attorney to do it for you. The benefit of hiring a patent attorney is that they should be able to help you draft your claims more exhaustively, so that the rights to your invention receive the best protection. But be aware that patent attorneys will rely on you for technical matters, so you'll need to be able to explain the technical issues of your invention to them. You'll also need to prepare all the diagrams that typically go with your patent application.
5. File your patent application with the Patent Office. Filing the patent application with the patent office is relatively simple. It's a simple matter of paying the filing fees, and submitting the necessary forms. If you have engaged the services of a patent attorney, he/she should be able to do this for you.
6. Patent Prosecution. This is the period when the patent examiner looks through your patent application, and sees if it meets the novelty and non-obviousness requirements to be granted a patent. He/she may raise an "Office Action", meaning that he/she does not agree with the scope of nature of your application. This happens in the majority of patent applications; sometimes the patent examiner may have a strong objection, or sometimes he/she is just trying to better understand your claims. The Offcie Action typically falls into three categories:
(a) a claim is considered obvious. This can happen if the examiner feels that a combination of earlier patents / claims put together would "obviously imply" the claims that you are making.
(b) a claim has already been patented. This happens when one of your claims has already been made in a prior art patent. In this case, the claim usually has to be abandoned. In the newer accelerated SPP filing process, this should happen less often, since you will be doing a claims search before filing your patent application, to make sure that your claims aren't already in prior art patents.
(c)
a claim is unclear. The examiner may request more information to understand your claim. This usually happens when the examiner is unable to understand or unable to see how your description of the invention is related to your claims.
You will need to respond to the Office Actions promptly, because they typically have a response deadline (e.g. 3 months). In your response (called your rebuttal), do your best to address the objections that the examiner has raised for each claim. You may need to reword your claims, or show how your claim is novel and non-obvious. You may even need to combine several claims into one to meet the examiner's objections. If you have a patent attorney, he/she could be very helpful in preparing the response to the examiner.
If the examiner disagrees with your rebuttal, you will get a 2nd Office Action called a "Final Rejection" to certain claims in your application. This usually means that the claim cannot be made. You will then need to assess if your patent still has any value if the rejected claims are removed. In some rare cases, your patent attorney may decide that it is possible to further negotiate with the examiner (in person or by phone), file an appeal, or even go to court to dispute the examiner.
The end result of the Office Actions is that you may need to either withdraw your application, or modify your application to remove or amend some of your claims.
7. Patent Award. Once you have cleared all Office Actions, your patent will be awarded to you. You'll get a letter from the patent office when this happens.
8. Patent Maintenance. Depending on the country you are in, the patent office may require you to pay maintenance fees periodically, to keep your patent active.