How do attackers put malware into pirated software?

Hello I have just started Reverse Engineering and Malware Analysis. I wanted to know what is whole process by which attackers put malware into a software after cracking it,especially without affecting the the functionality of the cracked software?