i always thought it was because of a person's strong heart that would attract a keyblade to the person, which was explained in KH1. but in order for that to happen i would assume the keyblade has to either already exist or be forged right then and there. in days, when roxas brings out his Oathkeeper and Oblivion for the first time, its like 'what the heck happened to Kingdom Key?' but this was after Xion disappeared too. im assuming there was some sort of connection between Xion (who was "Kairi" at the time) returning to Sora's memories, which altered Roxas because... well, he is Sora's nobody... and so Oathkeeper was formed. i dont know about Oblivion and how exactly it is linked to Riku besides the darkness part though, so im just going to blame that on Xion too. Sora can also wield these blades too...
but im pretty confused about Vanitas and Kairi (Riku forging it for her). i can only assume for Vanitas, since he isnt a nobody, that because he is physically half of Ventus' heart that that is the reason he can wield a customized blade. either that or Xehanort crapped one out for him, 'cause he probably can do that. now Riku in KH2 just randomly pulled out Destiny's Embrace, but that keyblade was actually first seen in BBS right? you acquire it after saving young Kairi from the heartless while playing Aqua's story, after Kairi gives you some flowers. so since Aqua had taken Master's Defender, and Terra had performed that ritual on him (im not actually sure if there is any connection between Kairi's forging and Terra's bequeathing but whatever), that keyblade had already been in existence and had been linked to Kairi before; maybe because she was too young to actually wield it she couldnt use it until KH2 when Riku "re-forged" it since he had the power to at that point in time.
Star Seeker and Kingdom Key D were clearly (at least design wise) combined to create Star Cluster. it likely was magic if he asked Merlin to help him, but he probably had to be there too because keyblades are linked directly to people's hearts (i think). Mickey had damaged his Kingdom Key D in the realm of darkness so he had to meld it together with Star Seeker to create Star Cluster, i guess? as for the process of combining im not totally sure about that yet, magic is most likely a crucial element, especially for transferring abilities and stuff so that the keyblade can actually stay powerful instead of just being a fancy sword. but an in-game explicit explanation would be pretty cool to really understand how forging and combining works.
if you cant tell im kind of just pulling information from the sky hahah but i hope it makes a little sense? maybe someone can correct me a bit. im still a bit new to the stuff sooo sorry if i sound dumb