Copyright protection automatically applies when you create an original work of authorship fixed in a tangible medium (e.g., written, recorded, or otherwise documented). However, registration is not required for copyright protection to exist. While copyright exists upon creation, registration provides additional legal benefits, such as the ability to bring a lawsuit in the case of infringement. It also serves as public notice of your ownership and helps in proving ownership in court if needed.
The decision to register a copyright is considered on a case-by-case basis. For example, software development often moves too fast to constantly register source code, especially at early stages. However, if you need to bring a copyright infringement lawsuit, you will need to register your copyright to enable you to bring the suit. Generally, people wait to register a copyright until it is necessary in order to file a lawsuit.