Can a manager be both effective and well liked?
Nope. Not going to happen.
If you're a good manager, you're going to make decisions that anger and upset some people. You are going to tell some people their work isn't good enough. You are going to hold accountable people who don't want to be held accountable. You are going to institute and enforce policies that may exist for a good reason but still irritate the heck out of some people. You are going to fire people.
If you never do any of those things, the probability is high that you are not an effective manager (or that you have only managed a handful of people, all of whom were really good). Generally, the reality is that at times you'll be managing people who aren't performing up to the bar you've set. And, in order to be effective, you're going to need to address it head-on. Some of those people are going to resent it—and, thusly, you—because many people find it far easier to blame the messenger than to listen to the message.
The best you can hope for, as an effective manager, is to be well liked by the reasonable employees and the most competent ones—those who are so good that they never have to deal with you correcting them or the ones who get corrected but are intellectually honest enough not to resent you for it. (And if it's the opposite—the incompetents like you and the rock stars hate you—it's pretty much always an indictment of you.)
So if you're deeply invested in trying to be liked by everyone, don't go into management. You'll either end up unhappy because some people on your staff don't like you, or you'll be ineffective because you let your desire to be liked trump the fundamental obligations of your job. (And, ironically, most managers who do the latter end up being disliked in the end anyway—because good employees get frustrated when managers won't address problems, confront slackers, or make tough decisions.)
Of course, the fact that you can't be liked by everyone isn't license to be a jerk. Part of being an effective manager is retaining good people, after all, and good people don't want to work for jerks. But you do need to make peace with the fact that there will forever be people complaining about that horrible person they worked for, and that horrible person will be you.
Alison Green is chief of staff for a medium-size nonprofit, where she oversees day-to-day management of the staff, as well as hiring, firing, and staff development. She is working with the Management Center to coauthor a book on nonprofit management. Her writings have been published in the Washington Post, the New York Times, Maxim, and dozens of other newspapers. She blogs at Ask a Manager.