Let's start with magic then
Magic in the Cosmere functions as conversion between matter, energy and Investiture. Our world (supposedly?!) only has matter and energy but the Cosmere also has Investiture, which facilitates conversions between the three. You can see Investiture as fuel or potential energy. Investiture also connects the three realms:
There are three planes of existence in the Cosmere: the Physical Realm, the Cognitive Realm (the realm of the mind, perception, where beings like the spren & "ghosts", or Cognitive Shadows dwell) and the Spiritual Realm (the realm of the soul, where space-time is one, everything is connected, this is where souls aka Spiritweb or sDNA exists and where the Shards dwell.
The Shards are, simply put, gods. They are pure Investiture, with an Intent. That means that they want to use Investiture oriented towards a certain theme. All Investiture is divided up amongst the Shards. But it wasn't always so. There was once a being called Adonalsium, who created the Cosmere.
Shards typically require Vessels: people who hold the Shard's power and direct it. The original Vessels took up the power of Adonalsium after an event known as the Shattering. There are 16 Shards: Preservation & Ruin, gods of Scadrial (Mistborn)
Honor, Cultivation and Odium, gods of Roshar (the Stormlight Archives)
Devotion and Dominion, gods of Sel (Elantris and the Emperor's Soul)
Ambition, god of Threnody (Shadows for Silence in the Forests of Hell)
Endowment, god of Nalthis (Warbreaker)
and others of whom we know very little as of now.
Hoid knew all of these original Vessels and was present at the Shattering.