In my writing posts, I've been talking about worldbuilding. You're doing worldbuilding whenever you write fiction, but we tend to think of it as relating to fantasy, where you're creating a different world that works in unusual ways. One of those differences is generally the existence of some form of magic, and that's one of the big pitfalls of fantasy worldbuilding. If you don't handle magic well, it can completely derail your plot. Magic can either make things too difficult for your heroes -- if the villain has it and they don't -- make things too easy for your heroes -- they can solve the whole thing with a wave of a hand -- or make your heroes look like idiots if they have the power to solve the whole thing with a wave of a hand and still go about it the hard way. If you're going to have magic in your world, you need to put some thought and planning into it. It's a really good idea to have at least a general idea of how your magical system works and what the rules and limitations are before you start writing, and then force yourself to abide by it. If you make up the magic as you go and resist codifying it into any kind of system along the way, you'll actually make things more difficult for yourself because it gets harder to come up with a plot that still works.
First, think about the source of your magic and who can use it. Where does the power come from? Is it in the atmosphere? In objects? In people? Is the ability to use magic something a person is born with? Is it something anyone can do, but some people can do better than others? Is it something that happens to a person? Is it genetic, running in families, or is it random? Does it require training? Do some people have more power than others, or is the difference in training? You don't necessarily have to spell all this out in your story, but you should probably have some rationale for which characters have magical abilities and which characters don't. You also probably want some kind of balance between the villain and the hero, enough to maintain a struggle, with some way of one side finding an advantage in the final confrontation. If one side is overpowered, it's hard to keep things going. Why doesn't the more powerful person just crush the other? Sometimes, that balance can come from the hero needing to learn and gain abilities -- he may not face the villain until he's leveled up some, might lose the earlier confrontation, then may grow some more until he's able to win. You need to build these possibilities into your magical system and think about how it plays into your characters.
Next, it will really help your plotting if there's some kind of limitation on magic use, whether it's a power supply issue, the way the magic works, or rules with real consequences. Otherwise, magic makes things too easy and drains all the suspense from the story. If all your magical characters can just wave their hands and do anything they want, non-stop, then you have to contrive ways to keep them from being effective immediately. It seems less artificial if limits are already built in. Your characters might get tired and hungry from all the power used to do magic. There may be more or less magical power in different locations. They may need to use tools, like wands, to use magic -- if your magic user is useless without a wand, it's easy to temporarily take away his power. They may need to use specific spells that require ritual or ingredients. They may need to know the incantation and motions to make a specific spell work. There may be rules about who can use what forms of magic in particular circumstances, with dire consequences if those rules aren't obeyed. If you want to really make things tough, there can be a major cost -- the magic user gives up part of her lifespan, ages, suffers pain, has to draw upon someone else's lifespan, uses up finite resources. All of these things keep people from just waving their hands and getting anything they want.
Having magic will change society in some ways. Part of that will determine -- or depend upon -- whether magic is open or secret and what the consequences are for spilling the secret. If magic is open, are the magic users in power? If not, why not, given that they have all that power? If magic is secret, the same questions apply -- are magical people secretly using their magic to get into power? If not, why not? If magic is known, what does everyone else think about it? Is it revered or feared? Have non-magical people tried to pass any laws regulating magic use? Are laws like that a reason magic is now underground, if it's secret? Does magic create a class system? How does magic affect day-to-day life? Has it affected the development of technology? How does it affect the economy if some people can create things out of thin air? What kind of transportation system is required if people can poof themselves from place to place?
One particular issue relating to magic is the possibility of magical healing. It's handy to be able to badly injure or even kill your characters and then get them back on their feet again without a lengthy recovery period, but that can also sap suspense from your story if you know that any magic user can wave a hand and heal any wound. If that's possible, why have hospitals and doctors? It works best if there are even more limits to healing than to regular magic -- that's a special magical talent, it takes certain training, it has a high energy cost, it may mend a wound but not take care of related problems like blood loss, etc. Then you can maintain some suspense as to whether a character will live or die and still have the chance to have a character healed, without guaranteeing that every character can be so easily healed and without making your characters look stupid or callous if not everyone is healed that way.
Magic can make writing easier in some respects -- I've had editors give up on nitpicking something in a book when they realize that they're dealing with a world where magic works. "A wizard did it" can be a perfectly valid explanation. But at the same time, making "a wizard did it" be plausible requires a lot of background work.