To chat, hit ':', type your message, and hit Return. By default, that will send a message to the #public channel.
You can send private messages to other players or to parties. Begin your message with the target name and a colon,
Bilbo: do you have the One Ring?
You can use short names, up to the point when there is no ambiguity. For example,
bil: well, do you?
will resolve to Bilbo, unless there's another online player or a party starting with bil. Even one letter should suffice.
The game will never send your private message to the wrong recipient in case of ambiguity, it will return an error instead.
When you enter the game, your default chat channel is #public. To change channels, type #channel_name into chat prompt, without any messages.
To send message to another channel without changing it, prepend channel name to your message, like so:
#public Cheers, lads
Note, that in current version of MAngband, you can only be on one channel at a time.