Your scientific work is protected by copyright. Copyright does not protect the scientific discovery itself, but your intellectual work on it, the form of expression of your idea or discovery. You as the author are the holder of the copyright. Copyright usually expires automatically 70 years after the death of the author. Their works are then automatically public property (public domain). In some cases, parts of the copyright can betransferred to third parties.
As the author, you can grant other persons or parties the right to use your work. You do this by clearly granting a license. Licenses are standard texts that legally define the further use of works. Typically, the Creative Commons licenses are used in science; these licenses are suitable for graphics, presentations, data, text documents and much more. As of version 4.0, the licenses are also suitable for data, but never for software.
The Open Data Commons licenses can also be used with data. For the licensing of software there are a lot of different licenses (e.g. MIT, GPL). The website "Choose a License" helps you to decide on a software license.
When publishing a scientific work, you regulate the rights of use to the publication with the publisher, for example in the form of a publishing agreement (Copyright Transfer Agreement, Exclusive License to Publish) or by means of the publisher's General Terms and Conditions. If authors grant exclusive rights of use to the publisher, their rights to further use the publication themselves (e.g. for self-archiving) are determined by the publisher's specifications.