The flag is a skill where one holds onto a vertical object and, with arms straight, holds their body horizontal to the ground. Correctly done, it'll look something like this:
Easy to see why it's called a flag.
UPDATE: I found this old photo of a balancing duo performing the flag. This was performed at the famous Muscle Beach in California, USA sometime in the 30's, 40's, or 50's. Absolutely incredible. Just goes to show the long history of bodyweight strength skills.

Anyways, back to the tutorial...
Where to Practice
The skill itself is hard, but just finding a suitable place to practice might prove difficult as well. You'll have to keep a sharp eye open for places. To give you some ideas and examples, I've done this skill on a secured ladder, a parking meter, a metal fence, a bleacher pole, my old front porch, my new back porch, inside a moving truck, a roll-off dumpster, a power rack, and a stack of chairs (see below)

Each place will have its own problems that you'll soon discover. Even my back porch (the first picture) is a bit of a pain due to a wider grip and slant to the top hand, but it'll do for this purpose. When scouting out a good spot to practice, I look for four things:
1. Correct height - I like my bottom hand to be about waist level or slightly below at the start of the skill. Too high or too low and it becomes a pain to press. If you have to bend your legs or get on your toes a significant amount, the spot may be at a bad height.
2. Correct hand spacing - This is one you may find the most difficulty with. Too close or too wide and the skill becomes close to impossible. I've found the arms should be coming off the midline of the body at about a 45 degree angle or slightly less. Take a look at the pictures to get the general idea.
3. Quality of hand holds - Can I actually get a good grip on the object? Or am I trying to hang off a telephone pole? This goes for both the top and bottom hand. A bad surface for the bottom hand makes it hard to push your body into position.
4. Stability - If the object is going to break in half or topple over when I put my weight on it, I'm not going to use it. Simple, but important.
Stability is the most important of the 4, and should be the one that you are always concerned with. The other factors may not always be the most ideal, but you'll soon find out what you can work with. As you try different places, you'll start to get better at spotting training locations.
The power rack is one location which may be the most widely accessible and easily adjustable. Take both of the spotter bars and put them on one side. You can easily change the spacing and height of the bars to get the best set up position.
Set Up
When you find a place to practice, you'll want to start by getting your hands into position. If you can get your palms facing each other, I feel that's the strongest position. On something like a pole, I find that facing your palms forward feels strongest, and for something like a parking meter, your hands will be in a mixed grip.
However your hands are placed, make sure they are in a straight line perpendicular to the ground. It's important that you start getting every part of your body in the same vertical plane.
So with your hands in place, get your head between your arms, and your body in the same line. If something is out of line, it'll throw your balance off and take you down.
Lift Off
Now with your hands, head, and body in line, start to lift the outside leg.
I find that lifting the outside leg first further helps to line everything up, as well as make the press into the final position easier. And speaking of pressing, this is the time I start to press with the lower arm. I'll further elaborate on the role of each arm below.
Anyways, you'll lift the top leg, PRESS HARD with the bottom arm, bring your legs together, KEEP PRESSING!, and get yourself in a straight line.
Balancing to the front and back is not difficult at all if you kept your body in a straight line. The difficulty arises with getting yourself horizontal.
DANGERS
There's only one major danger that can arise when working this skill - and that's if your body starts to fall to your backside. If you start to fall towards your backside, let go of your hands immediately and fall to your feet. The reason for this warning is that if you keep on holding while your body falls backwards, you have a great chance of ripping up your shoulders. It would be akin to holding onto a failed snatch as it fell down behind your back. You'll hurt your rotator cuffs if you try it.
Now the subtleties of the skill, as well as some ideas for progression.
The Top Arm
Despite what it may look like, the top arm really doesn't do much. It DOESN'T pull you up horizontal, as I'll explain below. Just keep the arm straight and hold on tight.
The Bottom Arm
The bottom arm is the secret behind the flag. It's what will get your body flying horizontal, instead of just hanging there. What you want to do with the bottom arm is PRESS!!! Really press and work to extend your shoulder. The shoulder itself has a very small range of motion, but this motion is important. If you're in a flag and your shoulder is not fully extended, you need to PRESS your bottom arm out more.
I drew up some diagrams to illustrate my point:

The first picture illustrates someone performing the flag with an inadequate press of the bottom arm. While the top shoulder is fully extended (from the weight of the body), the bottom shoulder is set in the socket deeper. Since this person's arms are the same length, the result is a downward tilt of the entire body.

The second picture shows what might be an instinctual reaction to try to level yourself out - pulling with the top arm. This really won't do much except make things look uglier. The top shoulder is still extended, and the bottom shoulder is not. The body will continue to remain below horizontal.

Now here in the third picture, we finally see what happens when you press out with the bottom arm. The shoulders are now extended to their limit. The top shoulder is being stretched into that position, while the bottom shoulder is being pressed into that position. Now the body is finally held in a true horizontal position.
Progression
The best way to progress towards the flag is to work on something that closely resembles it, but is a bit easier. A skill that fits the bill is a flag with bent legs.
The difference is simple enough to see; simply bend your legs when you go up into the position. This will put less stress on the arms and make it slightly easier to press into position. The balance is a little trickier because your knees and feet fall a bit out of the plane of your body, but you'll get the hang of it with practice. Once you can hold this position for several seconds, give the full flag a try.
I understand it's sparse, but this is the progression that I used to learn the flag. I also understand that the bent leg position may be impossible for some now, so I gave some thought to even easier flag-like positions. I didn't want to recommend a position that might teach bad form and ultimately prove detrimental to performing the flag. So in the end, I couldn't think of any progressive skills that would be as good as just general shoulder strengthening.
Such shoulder strengthening exercises could include working on/towards handstand pushups, with focus on strengthening your shoulder extension. If you can do several full range handstand pushups against the wall, then you're well on your way to getting the flag.
While against the wall working on handstand pushups, you can also hold the handstand position and work pressing your shoulders in and out. This is the same motion as the shoulder shrug I mentioned in the handstand tutorial.


Another exercise I think would be helpful is to put a book or two on the ground, and kick up into a handstand with one hand on the floor, and one on the books. Work on pressing up and really extending with only the book arm. This will work one shoulder through the shrugging motion with more weight than the two armed shrugging exercise. The elevation of the books helps to take away any assistance from the non-book arm. You can add or subtract books to adjust the difficulty.
Depending on your current training level it may take several weeks to several months to build the requisite shoulder strength. Test yourself every couple weeks with the bent leg flag. Once you can press up and hold it for a second or two, make that your primary exercise for working towards the flag.
The End
This is a fairly advanced skill but is quite attainable if you give it some focused training. It's tiring, so practice will be in short durations for short periods of time. Just always remember to keep your body in line, your arms straight, and to PRESS, PRESS, PRESS with that bottom arm!
So here it is again... the flag.
in position...
lift the leg up and press...
and done.
Good luck!