The short version is to sign out of the ID you don't want and then sign in with the one you do.
Sign out of iCloud on your iPhone, iPad, iPod touch, Apple TV, or Mac --> https://support.apple.com/HT208242
If another Apple ID is signed in you may need to enter the password for that ID to sign out of that ID first.
Click on this link to learn how to 'Sign in with your Apple ID' --> https://support.apple.com/HT204053
Set up iCloud on your iPhone, iPad, or iPod touch - https://support.apple.com/HT208681
For the long part...
Merging Apple Accounts or transferring data is not officially supported, nor can it be done easily or completely.
Apr. 2018 post by ASC helper Winston Churchill on transferring data from one Apple ID to another. https://discussions.apple.com/message/33333380#message33333380
Feb. 2021 tips from Eric Root https://discussions.apple.com/thread/252468781?answerId=254653802022#254653802022
Look into using Family Sharing to continue to be able to use items purchased with one Apple ID with other Apple IDs.
Family Sharing - https://support.apple.com/HT201060
Set up Family Sharing - https://support.apple.com/HT201088