It's not rocket surgery. You want the cables to be as short as possible, with only smooth bends, no kinking, but long enough that they don't restrict the movement of the handlebars.
Google some images of Kestrel Talon's and you'll get a visual to go by
Another approach:
The second approach, going under the bars is likely less aero, but might shift better.