It's an Addiction
When my teachers, and then my parents, found out I was cutting back when I was fifteen, I was unhelpfully told to 'just stop'. They considered punishing me for it, and it was made very clear I'd done something wrong. I knew very little about it, but I knew it wasn't that simple. I was in my early 20's before I really got to learn about the subject, prompted by the fact that it still hadn't gone away, no matter how many times I decided to 'just stop'. It wasn't exactly a huge surprise to learn I was addicted, but I was relieved. Until then I'd often been angry at myself for never having been able to let it go. Of course, it also means I'll be fighting it for the rest of my life, but at least I know what I'm fighting. You can't battle an enemy you're ignorant of. And it's a part of my now, it's been with me for half of my life, and we have a long way to go from here.
It works (but that doesn't make it ok)
There's a reason that self-harm is a coping mechanism. Deliberately inflicting pain upon oneself does temporarily lift your mood, cause a high and make life seem easier. However, it isn't healthy, adds a problem on top of other problems and can be dangerous. This one is still difficult for me, because of the little voice in my head telling me how awesome it is. Logically, I know it isn't.
It has nothing to do with gaining attention
Chances are, even if you don't know it, you've met people who self-harm. We are very skilled at keeping it a secret if we want to, because rarely does any good come from people knowing. For me, maybe because of how it was handled back then, I feel deeply ashamed when someone knows, and very few people do. There are also people who aren't too bothered by people knowing. It doesn't necessarily mean they want to talk about it, or that they want any attention, so just be cool about it. Even if someone were to hurt themselves 'for attention', it isn't how it sounds. If someone does that, you better believe they need some attention, of the right kind.
It comes in so many forms
My experise is only in cutting, but if you're worried about someone, it's worth knowing that there's all kinds of forms of self-harm-burning, starvation, drinking/drugs, punching walls, head banging (against walls, not along with metal music. Although, I never did get the hang of that without feeling like my brain was bouncing around inside my skull).
What to do if you're worried someone you know if hurting themselves
If you think that someone close to you is hurting themselves, as uncomfortable as it can be, try and approach them about it. Do some research on the subject so you're prepared, don't tell anyone else about it, show a clear lack of judgement and never patronise. Make sure you have plenty of time to talk and that it is in a completely private place where there is no risk of interruption from others. If you're wrong, you'll probably be able to laugh about it afterwards. If you're right, then ask them what they need. Don't bother with a simple 'If there's anything I can do', it's easy to say and rarely do people actually follow you up on it. Show it instead. Make an effort to create a safe space to talk when they want to. Help put together a box of their favourite things such as books, DVD's and pamper products. You could even do this first to show you care. Don't go in with a bunch of solutions. And don't let it get you down if you receive a negative, unpleasant reaction. If you believe they are taking every precaution to avoid being caught then it will be a shock to have someone bring it up. If they really don't want to talk about it, keep it in mind, and wait and see if they come back to you in time.