With monero-wallet-cli, you can sign the content of a file (e.g. message_file) with the command sign message_file , and verify the signature with verify message_file address_of_the_signer signature .

With monero-wallet-gui, in the menu go to Advanced -> Sign/Verify , then you can sign (or verify) a message or a file by filling the appropriate boxes.