Yesterday my first work in mathematics was sent to a publisher, and of course I'm interested in its usefulness. But I know, that sometimes it is hard to get a paper, it is not available for free. I hope my paper will not be of that kind. I hope it will be simple to find it and to read it, I hope a few hundred people will read it. Therefore I have this question. When do mathematicians usually lose their right to share their papers on the internet, why some of them doesn't like to do this and which ways are there to overcome these "sharing difficulties"?
Read any contract you sign carefully, otherwise you may lose rights you wanted to keep. In 2000, CRC Press sued Eric Weisstein because he posted free updates to the web of a mathematics book he had written and published with them.
Usually non-commercial publishers like the AMS allow you to keep any rights you want, while commercial publishers often try to get the rights for themselves (but will usually allow you to keep them if you make a fuss).
Some journals are public access. Some journals make articles publicly available after some time period, for example a year. Others are complete paywalls.
There is a distinction between the document you submit and the edited document which is published; your freedom to distribute the edited document may be more limited, although you will typically be able to share on an individual basis with colleagues.
Also there is arxiv. I would bet that you would be allowed to keep your preprint on arxiv as long as it is untouched by an editor of a journal, but I'm not positive about this and I would like to know more myself.