Here’s what to do…
iCloud
If you’re using iOS 10.3 or later, tap Settings > [your name]. Scroll down and tap Sign Out. Enter your Apple ID password and tap Turn Off.
If you’re using iOS 10.2 or earlier, tap Settings > iCloud > Sign Out. Tap Sign Out again, then tap Delete from My [device] and enter your Apple ID password. Then go to Settings > iTunes & App Store > Apple ID > Sign Out.
If you've already given us your tech or it doesn't turn on please see this article.
Samsung
From Settings, swipe to and tap Accounts and backup.
Tap Manage accounts, and then select your Samsung account.
Tap Remove account, and then tap Remove account on the popup.
Tap Sign out. Enter your Samsung account password, and then tap OK.
From Settings, swipe to and tap Accounts and backup.
Tap Manage accounts, and then select your Google account.
Tap Remove account, and then tap Remove account again to confirm.
If you have Google device protection features enabled, you may be asked to verify your identity before you can fully log out of your account.