I've been able to find a few glitches that can result in near-unlimited magicka and/or magicka regeneration. I have yet to confirm if the glitches are still in the game, however; so some (or all) of them may have been patched out.
While most of these glitches require deliberate exploitation, I have found reports of users running into the same glitch you appear to have experienced; that is, unlimited magicka seemingly out of nowhere. In these cases, I can not find any evidence of the exploits being easy to replicate.
By taking advantage of a friendly companion, you can mass-equip items while in werewolf or vampire form. This requires having a companion that will be friendly to you in this form. Activate the werewolf or vampire form, and immediately talk to the companion. If done quickly, you should turn into the werewolf or vampire, while also opening dialogue with your companion. Ask your companion to trade, and from the resulting trade screen, select to equip the items you wish to mass-equip. You will be permitted to equip as many items as you want. In this way, you can mass equip enough items to collectively give you near-infinite magicka or magicka regeneration.
Item Fortification Exploit
If you equip an item that gives you a boost to magicka, you will automatically replenish the bonus magicka points, even when empty. By hotkeying the item, you can unequip it and re-equip it on entry to automatically replenish the amount of given magicka points. You can then use this small pool of constantly-regenerating magicka to effectively have unlimited magicka.
- I found this video on YouTube, where the user reports (and demonstrates) having unlimited magicka, specifically for the schools of destruction and restoration. They show off the results, but do not show the glitch first occurring. They report that it happened when they dual-cast lesser ward and sparks.
- I found this post on Reddit, where a user reports suddenly having unlimited magicka. Others have posted under it, reporting a glitch that can sometimes happen after completing the "Out of Balance" quest in the College of Winterhold. During this quest, you can sometimes receive a temporary buff that greatly increases your magicka. This buff can sometimes glitch out and become permanent.
- As others have mentioned, there are various ways to boost your enchanting skill that collectively allows you to enchant gear with enchantments that remove (or considerably reduce) the casting cost of individual schools. I have seen reports that the original method of doing this (fortifying four pieces of equipment for a 25% casting reduction, each) has been patched out; however, I found this video on YouTube that details another method, where you fortify enchanting with potions to allow the creation of single 100% cost reduction enchantments.
- If you're on PC, you could always just open the console with ~ and type in
player.setav magicka 99999. This will give you a magicka level so high that it would be near impossible to deplete it.
- Depending on availability for your platform, you may be able to install a mod that provides the same benefits as unlimited magicka. As an example, there is the "Unlimited Magicka (Spells cost 0 MP)" mod on Nexus Mods.
- The Equilibrium spell restores magicka at the cost of health. By dual-casting Equilibrium with a restoration spell, it is possible to heal just as quickly as you regenerate magicka. This has no practical usage for providing unlimited magicka regeneration, but it can be a good way to quickly level your restoration skill.