How Does Software Cracking Work?
TLDR; Loads of different ways
It's different for every single piece of software out there. Some can be as simple decompiling the software, removing the license checking code and then recompiling.
For more clever anti-piracy techniques it might require changing or replacing a DLL or something which essentially has the same effect.
It can also be possible to disassemble the software and work out how it checks the license and then make another program (keygen) which can make codes which the software will accept as valid.
These aren't the only ways of course and I don't really have much insight into it.
All of the things: DemmSec