This number usually depends on the caster's Intelligence. But there are some items which can raise the magic bonus. You can check this number at the spell window. Basically it depends on the level and wisdom. There are also items which can raise the magic resistance.
Some items raise one specific type of magic or negates it.
There are also monsters who are more or less resistant to a specific type of magic. The power of magic increases if used on the monster with the opposite attribute. But decreases if the attribute is the same. Player characters can also have a specific attribute by using special items. Each spells can affect the caster's alignment also.