How do open source licenses work?
To answer this question, we first need to understand what copyright means and how it works. It is a long and complicated chapter in law, but greatly simplified, it can be said that the person who creates a work has the right to decide how the work may be used. The term "a work" can mean such different things as a book, a movie, a song, maps, visual art, or, more relevant to us in the computer world, computer software or software. Copyright legislation is largely unanimous around the world, but deviations may occur in some countries.
For software developers, this means that all source code written is automatically copyrighted. The normal case is that the natural person who created the work also gets the copyright to this. If you are employed, the copyright automatically passes to the employer for computer programs that are created during working hours. However, this can be agreed away, and it is also possible to transfer the copyright to other natural or legal persons through an agreement.
What we usually call software licenses, or often just licenses, function as a type of agreement that the copyright holder uses to talk about how others may use the copyrighted work. Companies that manufacture and sell software as a product regularly use so-called proprietary licenses, which often severely limit what the buyer / user of these licenses can do with the software. For example, it is very unusual to have to spread the work further or examine it too carefully through so-called "reverse engineering".
Open source licenses contrast with these proprietary licenses in that they allow users to use the program on their own terms. You can use the computer program as you wish, you can investigate how it works and to spread it further without the copyright holder's explicit permission. Examining how the computer program works is facilitated in the open source case by also gaining access to the actual source code for the computer program, and not just getting binaries that are often extremely difficult for people to read.
History lesson
In the early 1980s, when the exercise of proprietary licenses took hold in the university environments of the time, especially in the United States, some so-called hackers reacted strongly and did not want all software to be locked and inaccessible for all time to come. They wanted everyone to be able to read, understand in order to learn more about programming, change the code to adapt it to their own needs, and help others with their needs. This was the origin of the GNU project, from which several projects and licenses have since been developed. This idea was not originally called open source, but "free software". What the idea of free software and the GNU project wanted to achieve was that everyone would be allowed to use software indefinitely.
That way, the idea of copyleft was finally created in the form of the GPL (GNU Public License) license, which states: "Here is some software. You can copy it whenever you want; you can change it any way you want; you can investigate it and do what you want with the ideas it includes; but if you spread it, either unchanged or as part of something else you built, you also spread the rights you got in this software that you started with. " Or in other words: "share and share equally; not only of this software, but also what you build using it."
This obviously caused concern in the corporate world, where they would like to be able to sell software in the same way as physical products. In the late 1990s, a number of software enthusiasts came together and produced a version of free software that could also be used in the corporate world. This version was called open source, and is almost but not really, the same thing as free software. The clause of giving others the same rights you received when you started is often missing. This therefore benefits everyone except the users of the software, as they can still be locked into proprietary licenses and are not allowed to do what they want with the software they use.
Common forms of licensing
Choosing an open source license is not always easy. Many people usually say that they just want as many people as possible to be able to use the software in question, and therefore choose BSD or MIT as an open source license. Unfortunately, you can then miss some important positions. Therefore, you should preferably have a goal of how you want others to be able to use the software and think through other types of intellectual property issues, such as patents and trademark protection. In theory, BSD and MIT licenses deal with the patent issue, but only implicitly. If you want to be explicit in also allowing the use of any patents in the software, you should choose, for example, the Apache 2.0 license.
The licenses you can choose from can sometimes be limited by factors such as which licenses other software libraries used use. There are websites that can help in checking compatibility between licenses, but it is good to read about regular open source licenses yourself to get an idea of which ones are available and which ones allow what. Here is a list of good websites where you can read more about open source licenses.
https://choosealicense.com/ - Helps you choose the "right" open source license based on your own choices.
https://tldrlegal.com/ - Brief and easy-to-understand information about standard open source licenses.
https://opensource.org/licenses - OSI "certifies" and approves licenses that want to call themselves open source.
https://www.gnu.org/licenses/license-list.en.html - Comments from GNU regarding licenses and their compatibility with GPL in particular.