Musical compositions are owned by the song's "publisher," and usually the publisher gets half the money from exploitation of the song, and pays the other half to the writer. If a songwriter self-publishes, then the writer gets 100% of the income.
If a writer co-writes a song, they should always have a Co-Publishing Agreement that specifies what each co-owner/co-publisher owns. Deciding on the song "splits" upfront, before there's money to fight over, can prevent arguments later on.
Compositions and Recordings
A musical composition's copyright is distinct from the copyright in the master sound recording of the song. The composition's copyright is owned by the publisher, and the recording's copyright is owned by whoever paid for the recording, usually the record label. If a recording is licensed for use in, for example, a film, half of the license fee is paid to the master owner (the label) and the other half is paid to the owner/publisher of the song (who then pays half of their half to the writer, if different from the publisher).
Register with the U.S. Copyright Office
Songwriters should register their copyrights in their musical compositions as soon as they're written. See my Legal Guide - COPYRIGHT REGISTRATION - 3 METHODS.