There are options for what happens to the copyright of your article, chapter, or book when you publish it.
Retaining the right to put your work in a repository (also known as self-archiving) is very important for scholarship. It ensures that even if the journal or publisher ceases to exist (we are thinking very long-term) your content will still be accessible. It means that people in countries where the economy and exchange rate are disadvantageous can still read and do scholarship based on your content. It means that institutions with limited library budgets (basically all of them, these days) will be able to give their faculty and students access to your content even if they can't afford a subscription to a particular journal. This is called Open Access.
There are also Open Access journals, which make a practice of leaving the copyright of the content in the hands of the authors, and not charging their readers. Even if you publish in an Open Access journal, it is still a good idea to self-archive in a repository. The main thing we learned from the burning of the Library of Alexandria is that you should never have only one copy in one place!
SHERPA/RoMEO is a database that allows you to look up a journal's terms and conditions for publishing your article. You will be able to see whether you can retain the right to self archive.
For example, you can search for the Journal of Legal Medicine, and the result is highlighted in green. The key tells you that that means the Journal of Legal Medicine permits self-archiving with no special conditions.
Yellow would mean you can self-archive only a pre-print. This means that you could put up the version of the article that you submitted, without any of the changes you made on the advice of the peer reviewers. This is obviously less ideal, although it is still better than nothing.
Blue would mean you can only archive that post-print, the final version of the article.
White or no highlight means that the journal doesn't permit archiving by default, although you can still try to negotiate for it in your publishing agreement.
SPARC provides a variety of resources for authors to make use of when publishing their works. Please peruse the SPARC Author Rights page to learn more about what your rights are under copyright, and how to protect them when you publish. Central to SPARC's resources is their Author Addendum, which is a form you can complete and submit to a non Open Access publisher in order to retain the right to self-archive.
In many cases, when you publish an article with an Open Access journal, or with an addendum to your author agreement that allows you to self-archive, you will be charged. Open Access journals don't charge readers, so this is their economic model. Traditional journals may charge in order to recuperate losses they anticipate because of the content being freely available elsewhere.
These fees can be as low as $200 and as high as $5000 (although the higher extreme is rare.)
It is important to estimate how much the journals to which you would like to submit your work charge in author fees, and build that into any applications for funding.
Because author fees are an accepted practice, unfortunately some scammers have started to create fake scholarly journals in order to make money. The costs of soliciting articles and putting them on the web are very low, and they simply don't bother with the rest of the work of running a journal, which might cut into their profits.