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).