This is to add on to chillisauce.
I frequently see it being used in payloads. I understand it is done to
preserve space, bypass IDS among other reasons.
Shellcodes are normally written in hex and then when executed, they get decoded. They're not written like that for any of the reasons you mentioned though. Shellcode is often injected into the application during runtime, so it can't be written in some high level language bceause there's nothing to compile or interpret this code. When working with shellcode, we're working at lower levels in the application stack -- we're working with assembly, registers and what not.
Payloads are often encoded, which is probably what you were referring to. Encoding is done for many reasons - to remove bad characters that would hamper execution of the shellcode, creating signatures that would bypass AVs and a few others. You also have packers and cryptors which help in hiding malicious code. As mentioned, Shikata Ga Nai is a commonly known encoder which can be used to encode your payload. But then again, commonly known means it can't bypass most AVs, and can handle only certain sequences of bad characters, which is why experts often resort to writing their own encoders.
Converting assembly into Hex? nasm shell is your friend. Kali linux comes with this inbuilt. More specifically, I think it comes along with the metasploit framework. Nasm can help you do this
nasm> push eax
50 push eax
nasm> push eax ; retn 4
50 push eax
C20400 ret 0x4