Copyright infringement occurs when you use the creative works of someone else and claim cred for it. Sometimes, it can happen by accident or you have a legal reason that allows you to use the content.
The University of North Texas explains there are three general exceptions that can serve as a defense against copyright infringement claims.
You can use protected works in an instructional nature in a classroom. You must be in a nonprofit, accredited school for this to apply.
Another exemption is based on the TEACH Act. It allows you to use protected works in online classroom instruction. The act does have several requirements you must meet. One of those is you must include a copyright statement that you give students in the course.
Perhaps the best-known exception is fair use. This option has multiple requirements you must meet to make the claim. Generally, it also applies to educational settings, but it can apply in other cases as well. It can be difficult to use fair use as a defense because it is rather subjective. You must prove that due to a combination of factors the fair use doctrine applies to your situation.
You need to provide information on how and why you used the protected work. You also must show how your use impacts the potential marketing of the work or future sales. You want to show it would be very limited if any impact.
Ideally, you can work something out before having to defend yourself in court, but having a defense ready can be helpful.