I usually do a 10-15 minute consultation before taking on a project and a lot of people are worried about patent infringement from the beginning. Not about infringing upon other people's patents, but about others infringing upon their future patent. It's often difficult to answer questions regarding what would happen if someone infringed upon their future patent (when there is not even an application pending). The best that I can respond is to say that I would have to investigate and conduct an infringement analysis to decide whether there is actually an infringement, and if there is: 1) send a cease and desist letter; and/or 2) dive into a lawsuit.
When filing a patent application, the first thing you should be worried about is the patentability of your invention, not patent infringement. This means making sure that your invention: 1) qualifies as a patentable subject matter; and 2) is patentable in light of prior art. There are other things to take into consideration as well of course, such as enablement, statutory bar, and inventorship, among other things, but we won't go into that right now.
How do you know that your invention is patentable? Well, you won't know for sure (even when your application is pending) because the USPTO makes the ultimate decision on whether your invention will be allowed or not, but the best thing to do is to conduct a patent search (before filing a patent application and sometimes even during). And if your patent search comes with a patentability analysis*, then you may be able to identify some novel features of your invention to highlight in your application.
Why do I stress on patentability before infringement? Because thinking about infringement is like counting your chickens before they hatch. There is no patent infringement without a patent. Your goal should be to get a patent in place first. Also, the language of your claims, as well as the claims themselves, during prosecution will change several times. And because your claims in your patent will dictate whether there is or there is not an infringement, you really have to wait until your claims are allowed and your application is registered into a patent before you can do any infringement analysis. Therefore, asking yourself, "What if someone infringes upon my patent?" before even filing a patent application is very premature.
A better time to be worried about patent infringement, in my opinion is, during patent prosecution at the earliest, and of course after your patent is registered. Patent prosecution is when you're starting to amend your claims and get them in shape for allowance. After a few amendments (say after your second or third office action), you will have a pretty good idea of what your claims will ultimately look like when they're allowed. This is a better time to be thinking about infringement because you can amend your claims based on how you don't want your patent to be infringed. Said another way, you should go through each limitation of your (independent) claims and see which ones are necessary to overcome the prior art and show that your invention is novel; and which ones can be left out to leave your claims broad as possible.
As a side note, another thing that people are always worried about is: "What if someone works around my patent?" My take on that is, someone, somewhere, at some point is always going to try to work around some patent. That is the whole purpose of the patent system- to increase the wealth of public knowledge and foster competition. Even the best patents with well drafted claims will motivate someone to find a loophole. With that said, the best you can do is to make sure that your disclosure in your specification is solid, thorough, and detailed. And that your claims are robust, well drafted, and legitimately broad as possible. If you want to introduce new information, file continuation applications. Then once your patent is registered, you have to closely monitor your patent and keep an eye on your competitors. Optionally, you can budget for growing and managing your IP portfolio. Lastly, remember this: a registered patent is better than no patent. If your invention is that important to you, then a patent is the best form of IP protection.
* Not all patent searches come with a written opinion from a patent agent/patent attorney stating whether your invention is likely or not likely to be patented. This means that your patent search report will include a list of relevant patents and patent application publications, and it will be up to you to look through each one and decide whether it's too similar to your invention or not.