All ransomware implementations are different, but for the most part, the particularly stupid variants that did things like use a hard-coded key, or used easily guessable or reproducible key generation methods have been weeded out and replaced by much stronger variants.
For wannacry specifically, each infection creates a new RSA keypair on the machine being infected. The private key from this pair is then encrypted with a public key shipped in the malware, which is part of a keypair owned by the wannacry author.
The new, infection specific public key is then used to encrypt the AES keys, which are generated using a CSPRNG, and a new AES key is generated for each file encrypted.
Presumably once you pay the ransom, the malware authors will then use their private key (the other half of the keypair to the public key hard-coded into the malware) to decrypt your private key, which the decryptor tool can then use to decrypt the AES keys, and in turn the files.