A magic system typically defines a set of non-standard attacks and effects which are limited by an in-game restriction, such as a resource required to use those abilities. A magic system might be derived from the games lore, or the other way around.
It is quite common to combine more than one of these methods.
A Mana/Chance system might allow memorization of any number of spells, with the drawback that they cost mana and may fail. NetHack does this.
A Slot/Mana/Chance system might allow you to memorize a short list of spells, which then may be cast as above. Crawl does this.
Spells consume spell points from a separate unique resource (usually given a short name like ‘MP’ or ‘SP’) when cast, but spellcasting is otherwise unrestricted. Variations include: ‘Aspected Mana’/Multi-pool
(fire mana, water mana, offensive mana, defensive mana, etc.); spells consuming things other than mana (hit points, material components, food/nutrition, etc.); spells consume more than one type of thing/aspect of mana (e.g. 3 fire mana and a stick of charcoal).
Spells must be prepared in advance, after which it may be cast at any time. In many systems, once a spell is cast, it is consumed; to cast a spell twice, it must be prepared twice. Typically the maximum number of spells that can be prepared is finite, either with an explicit cap (‘Slots’), or by requiring a finite resource (i.e. material components). Variations include: more powerful spells require more slots/resources; [D&D](dungeons_and_dragons.md-style leveled slots; prerequisite spells that implicitly consume extra slots for powerful spells.
Spellcasting is essentially free, but has a large chance of failure, especially for high-level spells. A variant is to have the chance of failure be affected by some combination stats, skill, or environment.
See spells.