For starters, you must be born with magic, or have a friend born with magic. A witch has access to the spirits and all sorts of unnatural types of magic. Bonnie comes into handy here. Secondly, to resurrect somebody who is dead and not on The Other Side, you must access a lot of power, which may or may not kill the person channeling the energy.
You get to bring your friends back from the dead, if you are willing to disrupt the balance of nature, harness large amount of power, and/or go against the spirits and use dark magic.
There is always a consequence for disrupting nature, which may include seeing ghosts of ex-girlfriends or allowing enemies to have physical contact with this world. The witch might also risk their life in an attempt to do this.
Bonnie Bennett brought Jeremy Gilbert back from the other side not once, but twice, the latter time resulting in her own death (temporary, of course).