Many journals in STEM allow you to share a preprint of your journal article on a preprint server or institutional repository. These preprints are those that are basically the draft of the manuscript submitted to the journal. They have not undergone the reformatting that the journal performs. Preprints may actually be items that have not gotten accepted and sometimes are items that never get published.
A postprint is the final accepted version of the manuscript, but without the journal's reformatting for publication. Some journals allow these to be shared via preprint servers and institutional repositories.
Some publishers may allow you to submit the final journal-formatted version of the article to a preprint server or institutional repository. This is typically reserved for titles that are open access or for which an open access fee has been paid.
Note that while preprints and postprints are most associated with journal articles, they are also sometimes used for conference papers ad book chapters.
Always examine the policies of the publisher for which of these options they allow. Publishers may not publish your manuscript if you violate these policies.
Below are links to preprint and postprint policies from major publishers. Note that some specific journal titles may have slightly different policies, so it's always best to check with the specific journal. Some of these pages may include other publisher policies, so you may need to search or browse for the appropriate section.
These links focus on journal articles. Book, conference paper, and other formats may have other policies..
Large Multi-Subject Publishers
Select Discipline-Specific Publishers
Wikipedia maintains a list of policies for a larger list of journals.