Copyright, a form of intellectual property law, protects original works of authorship including literary, dramatic, musical, and artistic works, such as poetry, novels, movies, songs, computer software, and architecture. These works can be published or unpublished.
Copyright does not protect facts, ideas, systems, or methods of operation.
You do not need to register your work with the Copyright Office in order for it to be protected. The biggest consideration is that it must be in a fixed and tangible form to be protected. This means as long as you have a physical representation of you work it is protected from the moment that you create it.
There are certain circumstances where the creator does not retain rights to the work. One of these is if the creator was hired by an employer to create the work or it creation is a part of their duties. In this case the employer is considered the author of the work or that the creator and employer have joint ownership. Creators are also able to waive copyright protection for their work as well. This can be done Open Access or Creative Commons, which allow creators to waive certain rights while keeping others.
This is very important for your own work but also important to remember about the work of others as well. Just because something has not been formally published does not mean that copyright does apply, this is why it is always important to be mindful of how you are using other's work.