Magic works on a similar concept to everything good parent teach you. Such as: Action and consequences (something will always have a reaction). You can't be evil for evils sake. My favourite is Balance is the key to EVERYTHING!
First, there are many different types of magic -- natural magic, practical magic, high magic, ceremonial magic -- and each is a little bit varied from the others. Even when it comes to spell work, you'll find a number of opinions on the Hows and Whys of the process.
In natural magic, there is a theory that many natural objects -- rocks, roots, plants, animal bones, etc. -- have a connection within them to some part of the human experience. For example, a rose quartz is linked with love and matters of the heart, a piece of oak would take on the attributes of strength and sturdiness, and a sprig of sage is connected to wisdom and purification. In this form of magic, also called sympathetic magic, the link between items and their magical symbolism is referred to as the Doctrine of Signatures. Spellwork in natural magic is often carried out with no prayer or invocation to deities or gods. It is simply the natural attributes of the items involved in the spell that make the magic happen.
In some traditions of Wicca and Paganism, magic is the realm of the Divine. A practitioner may call upon his or her gods for intervention and assistance. For example, someone doing a spell working to repair their damaged love life might call upon Aphrodite for aid. A person moving into a new home could invoke Brighid or Freyja, goddesses of hearth and home, as part of a ritual.
There is also a school of thought that believes magic occurs only in accordance with one's will -- in other words, intent is everything. Some people in these traditions believe that the physical trappings of spell work -- candles, herbs, etc. -- are unimportant, because all that really matters is the strength of will to bring about results. If one focuses one's intent precisely enough, and manipulates the necessary energy, change will come about.
Regardless of how you believe magic actually works and whatever tradition you choose to embrace, understand that magic is a skill set that can be used in tandem with the mundane. While magic will not solve all of your problems (and probably shouldn?t be turned to as some sort of cure-all) it is certainly a useful tool when used sensibly.