The complete answer you need can be found here.
First, let's answer a more basic question: "What causes my magic skills to increase?"
In some magic schools, your skills increase due to the base magicka of the spell:
- Alteration
- Conjuration
- Illusion
- Restoration (for non-healing spells)
For other magic schools, your skills increase based upon how much raw damage you cause/heal:
- Destruction
- Restoration
Now we can answer your original question. The answer is...
It depends on: the school of the spell, your gear, and the perks you have in the school.
Here are some examples:
If you have gear that decreases the magicka cost of Illusion spells, you should be able to cast more during combat and level Illusion faster. Note: only the base cost of a spell matters, so any cost-reducing gear will help.
If you have perks that decrease the cost of your Alteration spells, you will level Alteration more slowly because you won't need to cast them any more often.
If you have perks that increase the damage done by Destruction spells, you will level Destruction more quickly because you will kill things more quickly.
In my opinion, Restoration is easier to understand. If you heal better, you stay alive longer. And the key to leveling skills faster is to not die.