That is a good question. Magic to me is the manipulation of energies within our universe for an intended purpose. Magic is not good, it is not bad, it is only as the caster sees fit to judge it. Magic is designed to benefit the caster, as well as others around the caster, if done correctly and for just reasons. I like to think of all energy as a giant and elaborate spider web. Every time somebody raises energies, they pluck that area of the web, sending vibrations to the spider who inhabits the web. Some people would call this spider a higher power, or the universal energy. Whatever you call it, it responds to your plucking of the web and the vibrations created. Now with magic, the result is never 100%. Sometimes it works, sometimes it doesn't. Sometimes it goes wrong, or works but not in the way you intended. But that is where the fun comes in. Magic is very expirimental, and very much like trial and error. You do, and keep doing what it is you are doing, see if it works. If it does, then happy day you are a success, but if it fails or goes wrong, you change it and keep trying until you get it right.
As people have mentioned before, everyone has their own definition of magic. This is my definition (the only one that would make sense; asking how magic works/what is it is like asking how to breath in my opinion). Anyways, i hope this helps.