iCloud is built into every Apple device. It securely stores your photos, files, notes, and more, keeping them up to date and available wherever you are. Anything that lives in iCloud can be accessed on any of your devices, as long as you’re signed in with your Apple ID.
What you store in iCloud depends on your settings, and you can change them at any time in Settings or System Preferences. Many of your favorite apps already use iCloud, including Mail, Contacts, Calendar, Reminders, and Notes.
Additionally, you can choose to store your messages in iCloud and your photos in iCloud Photos. Every time you add something new to an app that uses iCloud, like a new photo, note, or message, it will automatically upload and save to iCloud, as long as your device has a Wi-Fi or cellular connection, and battery life.
Source: https://ijunkie.com/
That means your device will connect to iCloud throughout the day, making sure that your content is safely stored and up to date. But remember, if you delete something stored in iCloud, it will be deleted from all of your devices. So make sure you don’t need it any more before you select Delete.
iCloud can also keep the rest of your information on your iPhone, iPad, iPod Touch, and Apple Watch safe too, with iCloud Backup. This includes your app data, device settings, Home screen configuration, and more. It also keeps a record of your purchase history from iTunes and the App Store, including your music, movies, TV shows, apps, and books.
Because iCloud Backup only backs up the information on your device itself, it doesn’t include items already stored in iCloud. Backups happen automatically once a day when your device is connected to Wi-Fi and power and your screen is locked. The backup then gets stored in iCloud alongside the rest of your important stuff.
Source: https://www.macrumors.com/
And if you have multiple devices, you can back them all up to iCloud. If you ever need to restore the data on your device or set up a new one, iCloud makes moving your content a seamless experience. Your device will be restored from the backup, and anything stored in iCloud will be accessible once you sign in, including content purchased from Apple services, like apps or movies. And that’s how iCloud makes sure you always have access to the things that matter most.
Source: What does iCloud back up and keep safe? — Apple Support