Attachment occurs whenever you are trying to get rid of or avoid something you don't want.
It follows the simple rule that what you resist, persists. Or what you are afraid of, you attract to you.
What happens is, when your mind chooses to perceive that something is separate from you, and that this thing is in some way against you or behaving in a way that you do not want, or is having an affect on you that you do not want, you are actually choosing for that thing to happen. And so you are actually keeping it and creating it. You are effectively visualizing it and believing in it.
When you decide to see someone as your enemy, or a situation happening that you don't want to happen, your mind becomes split. Within the confines of your mind there will now be a sense of identity that you want to keep and protect (ego persona) and a seemingly separate projected enemy that you are resisting (ego shadow). You will perceive that the shadow-part is within someone else, or within a situation, and that it is trying to attack the persona part of you, and thereby cause it to be afraid.
What you may not realize is that your own mind is now in conflict with itself and is literally scaring itself, by having this perception of separation and victimhood. It is not really another person or situation that is causing the fear, but the portion of your own mind that you perceive IN or projected ONTO that person or situation. And that's your own mind's content. You've made an enemy of yourself.
So now you have this mind which seems to have two parts, which are against each other, and the persona part is resisting or trying to deny or push away the shadow part. And as such it seems to project outward. And that means that you now have this booger hanging around in your mind which you're trying to shake off, but it keeps sticking. And the more that you try to get away from it, the more you reject it and hate it, the stronger it seems to become.
Denial is an attempt to push away, but this pushing away actually broadcasts and transfers every. It simply funnels more energy from the persona part of you into the shadow part of you, and so you literally 'empower' or give power/energy to what you think of as your projected enemy. As you try to get rid of, deny or resist stuff, your 'rejection' of it seems to you like a pulling away, but it is in fact an attracting towards. Your attempts to PUSH your enemies away therefore brings you closer to them.
So now while there's one part of you that is thinking hey, I don't want what 'they' are going to do to me, and which is actually already perceiving that they ARE doing something to you - you see them as a threat or danger - there's this other part which is firmly anchored in and as that very threat. So you've effectively latched onto that person or situation with your mind, as though you cast an anchor overboard and it's hooked itself into your worst enemy.
The way you will generally experience this is that you feel like you've become vulnerable. That there is now some part of you that is weak and afraid and susceptible and exposed. And this exposed part experiences itself as accessible to the projected enemy, it feels like it is unsafe and very visible and noticeable. Your mind reaches out (in its projection) and latches onto that person or situation and forms a kind of energetic connection to them. Through projection you've basically taken your mind and stretched it out and have tied it into something outside of you. Now it seems like there's almost a kind of funnel or bridge joining you to your worst enemy, as though this allows them to gain access to you and target you and upset you.
When this happens, often you'll find it hard to stop thinking about that person or situation. They will keep coming into your mind. You'll keep having fearful thoughts about them. Or if it's driven by anger (which is usually based on fear) you'll keep feeling more and more angry about them, as though you just can't put it down and can't let go of feeling this way. This energy seems to keep coming up inside you to remind you that you are not at peace about them, and they are simply "on your mind" all the time.
So what's happened is, by creating a split in your own mind, forming a sense of threat and an enemy, creating a persona and a shadow, and projecting it outward onto something separate (which really has nothing to do with anything - its just a scapegoat), you've become "attached" to that person or situation. While you seem to be wanting to get rid of it, you are keeping it even more.
Each time you try to escape from it, it follows you. Every time you try to avoid it, it hunts you down. The more intensely you try to remove it from existence, the more it seems to become empowered and gains extra staying power. You just can't seem to shake it off this way, because you are moving your own power around in your own mind and are visualizing yourself being your own enemy.
So there is an attachment in place, and it's there because you have not forgiven, and are at war with yourself. What you need to do in order to energetically, mentally and spiritually stop being so agitated and upset 'by' this supposed opponent, is obviously that you need to apply some forgiveness. That is, you need to get really honest about who is doing what to whom, and what is happening in your mind, and own up to the responsibility you have of MAKING them seem like they are doing something to you.
The 'sword', if you will, which will cut through this attachment - which actually can take on the form of a 'cord of fear' that seems to tie between you and others, is simply to recognize and affirm that "they are not doing anything to me" or "I am not being affected by them". This is a taking back of the projection and it almost immediately will deflate the sense of exposure or vulnerability, will massively decrease your fear, will stop you from obsessing about that person or situation, and will help you to return to some sense of having power and peace. You need to then simply complete the forgiveness the process, taking back all of the power you gave away, owning up to the fact you have only been doing this to yourself, and thereby LET GO of whoever or whatever it was that you were attached to.
So in this process there is an owning up, and there is a letting go. You actually have to learn what it feels like to let something go, to drop it, to relinquish the attachment. It feels strange particularly if you are used to being controlling (afraid). It means allowing people and situations to be as they are, regardless, unconditionally. Letting go of believing that you have to do something about it, or that there's something wrong with it, or that it's simply 'wrong' and upsetting you. Learning to let go means, ultimately, letting go of all sense of being at war with yourself, letting go of the split in your own mind and surrendering to God. It is a letting go of the ego, because the ego is nothing more than self attack. And once you do that, you will have peace.
P.S. Archangel Michael can be particularly helpful in cutting energetic cords, fear attachments and other such gunk if you ask for his help in clearing you, and helping you to detach and let go.