There are so many ways enemies do this, especially if they are the predatorial, opportunistic and unscrupulous kind.
Some enemies will pretend to be your friend and will have a double personality while undermining you or even using you. All the while, they may keep pretending, apologizing etc and all types of tactics until they are done or get what they want.
Those are the worst kind as they try to get the closest to take advantage of you.
For those on the defensive and not out to hurt or use people they don't like or care about, once you do know of an enemy and thier ways, it's important to always be aware of that knowledge and be on the lookout for attack sometimes behind your back. That way you won't be surprised. The biggest mistake is giving your trust away too easily.
Also, it's important to be aware of who you are as in your values and what other people are because that conflict of interest itself can breed predatorial relationships and can be hurtful. People usually have a disdain and disrespect for others that are very different especially in value systems and they may want to undermine or even outright hurt you for it. It's like prejudice, so you've got to be aware of what company you are in or dealing with so to speak. So you know how much or little to reveal, how much trust they are worth, and if they will even understand you etc. Actually, very good learning of how NOT to attract enemies in consorting with the likes of the wrong kind for you. For this, i've found takes experience and sometimes bitter experiences. You can't trust appearances or even acts, people do that all the time.
I think keeping your friends close and your enemies closer has to do more with not letting your enemies know you are onto them so you can always maneuver not so much being around them as in association because that is not good at all. Or more bluntly, knowing your enemy is more important because they are out to hurt you and your friends are not. So that's the jist of keeping your enemies closer, just know them, how they operate, what makes them tick etc.