How do you use magic?
After Divine Divinty official manual in chapter about combat you can find;
If you prefer to fight using magic, you can cast spells on your opponent by right-clicking on them. This will cast the currently selected spell.
Browsing skills:
To select a spell or skill to use during the game, click on this icon to display a list of skills you currently know. You can now left-click on one of them to select it for use. To use a skill or spell, right-click.
And assigning hotkeys part
During a fight, it can be a little awkward to have to select a skill, a potion or a weapon to use. Thank- fully, you can assign hot keys to specific items so that you can select them at the press of a button. While browsing weapons, skills or potions, you can assign one of the function keys (F1-F12) to that item. For instance, to assign the F1 key to the health potion, simply click on browse potions, move the mouse pointer over the health potion icon and press the F1 key. You will see F1 appear on the potion icon. The same goes for weapons and spells.
If you want use other than deafult hotkeys use this tutorial to change that.