Copyright and patents are two widely-used software intellectual property frameworks -- software developers and team leads need to be cognizant of these frameworks in order to understand which licensing terms can be used to protect their software and achieve their project's desired goals.
When it comes to software, the two primary legal frameworks used around the world to govern intellectual property rights are (1) patents and (2) software. Patents are related to the novel ideas embodied in the software, while copyright is associated with the expression of the code itself.
Copyright grants the creator of an original work the exclusive rights to its use and distribution. Rights of particular interest for software include reproduction and distribution of the work, and the creation of derivative works. License agreements provide a means for the owners of the intellectual property rights to selectively grant rights to others. In nearly all jurisdictions, software (and other original works) are subject to copyright on creation -- you to not have to do anything special to claim copyright. The work might be owned by you, or by your employer if was "work for hire". IP rights are often set out explicitly in employment contracts.
Licenses span a spectrum depending on the rights they grant. The most restrictive is "all rights reserved", which grants no rights to others. Proprietary or closed licenses grant limited rights, which typically restrict the distribution of the source code and the ability to create or distribute modified versions. Free or open licenses grant those rights, in some form, to others. At the far extreme in the spectrum is the public domain, which is the complete absence of any copyright.
Two organizations, the Open Source Initiative and the Free Software Foundation offer widely accepted definitions of what constitutes either "open source" or "free" software licenses. The definitions are different in detail but functionally very similar. Within the category of free or open software, licenses are often further categorized into "copyleft" or "permissive" according to how they treat derivative works. Copyleft licenses require derivative works to be distributed as open source, while permissive licenses allow re-licensing of derivatives, including proprietary licenses.
The choice of which license terms to apply to a software product can depend on a number of considerations. Often research sponsors and employers have policies or preferences regarding licensing. Various goals of the developers can also play an important role, of course.
Some licenses include terms related to patents. Patents are quite different than copyright, as they protect novel ideas or "inventions" regardless of the form in which they are embodied. The patentability of software is a topic of some controversy at present, but in practice, most jurisdictions presently allow patents on inventions that are embodied in software. Note that it is possible to infringe on a patent without even being aware of its existence, whereas copyright applies to the specific embodiment (the code) only.
Some projects require contributor agreements when submitting software. These are legal agreements that make explicit the terms under which the developer is conveying the software. In the absence of a contributor agreement, the contribution is typically made under the assumption that it will be distributed under the same license terms as the existing code base.