Well, here is how!
1) DON'T text him all of the time. It may seem like it will have the opposite effect, but it really won't. If you text him too much he will get really annoyed and you wont stand a chance. So text him once a day at the most and only about 4 or 5 days a week - then you won't come across as needy.
2) Have things to talk about. Before texting him, it is a good idea to have topics in mind so the conversation doesn't go dry. So talk about school, or what you did over the weekend, and random things (like a food that you recently ate but didn't like).
3) Keep the conversation light. Yeah, it is good to have an intellectual debate every now and again, but not all the time. The lighter the conversation, the more natural it will feel. It also creates more opportunities for being flirty.
4) Be positive. This applies to every situation, not just texting. Don't go on about annoying parents or whatever, because he will run a mile.
"It's a good idea to have topics already in mind, so the conversation doesn't go dry"
5) Use emoticons. They are a great way to express emotion, lighten the mood, and show when you are being flirtatious. If you want to come across as being flirty use ;-) a lot.
6) Slip in compliments. But make sure that they aren't too direct. For example, if you have been watching American idol and you know that he is into music, say 'I bet you can easily do way better, your voice is so nice to listen to ;-)'
7) Be yourself. It is the most important one. Don't try and be someone who you are not. Text things that you will actually say in person.
Good luck texting!