A work produced either by an employee within the scope of employment or by an independent contractor under a written agreement.
Copyright attaches to the author of the intellectual property. The author of the intellectual property is the person who actually created it. The only way to circumvent this is to have a written agreement that describes the work as a “work for hire”. The exception to this rule of copyright law is that a “work for hire” can be implied if an employee is hired for the explicit purpose of creating intellectual property for a company.
If you are concerned about working in a company as an employee and creating intellectual property for yourself that is not considered a work for hire, then you should create an agreement between the company and yourself (like an employment agreement) that defines the job roles you have in your company. That way, if you have any side projects that are unrelated to your company, you will maintain authorship of that content (like a personal blog or software code you develop in your spare time). As with most issues, you need to make sure there is a distinction between your company resources and the personal resources you use on your side project.
If you regularly work with independent contractors, there is no presumption that the work is a work for hire. With independent contractors, the agreement must be in writing and must explicitly state that the work being created is a work made for hire, which will be owned outright by the one paying for the work, not the one creating it.
Any time you are working with intellectual property, or you are hiring someone to create an idea you have, you need to make sure you have a written agreement outlining what happens with the intellectual property. Whether you use an employee or an independent contractor, you want to make sure your company is the author of the intellectual property created by those you pay to create it. Many of the protections you may have as the creator of a work only exist if you have a written contract. As so much of the value of your business is in intellectual property, this is something you do not want to mess up.