It depends on the horse, but the basic idea is the same. Thankfully, my horse runs to the right barrel so I didn't have to remember that in a run =P
I work on loads of conditioning, spending as least amount of time on the pattern as possible at first. I do alot of trotting. Up and down hills, extending and collecting. I work alot on suppleness and on making sure he has all the solids down. I do reining patterns, etc. Then I get to the pattern. I'll walk him through it. Teach him where to set. So example, walk up to the barrel, have him stop where I would want him to set during a run, have him stand for a few seconds, then go to the next barrel and repeat. I only work at a walk until he has that down. Sometimes I wont ask him to set though -- Just to make sure he's listening. Or I'll only ask him to set at the second barrel (Diesel has the hardest time with that one). Then I will repeat with a trot, then a lope. Taking my time with each one. (This all isnt done in one day obviously).
While doing this, even at a walk, I make sure to ride the exact same way I would at a gallop. I sit how I would, keep my eyes where they should be and give all the same aides. Repetition.
After awhile, speed will come easy. Especially if you trot alot. If he learns to comfortably extend his stride between barrels, then go around them comfortably you will shave seconds off your time. But make sure not to only run barrels. And don't actually RUN them at home too often either. Barrel horses are known for getting sour on the pattern or for getting hot-headed. And making sure he stays sound-minded and interested by doing other things is a great way to have a healthy barrel horse.