Without going technical and disregarding the Base58 decode part:
It's basically the last few characters of the WIF private key, that was created by hashing the other parts of the prv key and it's inserted at the end as a the checksum.
So changing a character from the first few characters of the private key will produce a different hash that will mismatch with the checksum.
Or changing a character from the last few characters (checksum) will make the checksum different than the hash of the rest of the characters.
A mismatch means an invalid WIF (Wallet Import Format) private key.