Stout Halfling (counterintuitive, but hear me out), Eldritch Knight Fighter 13, Rogue (or Sorcerer) 2
AC: 18, 20 with Haste, up to 25 with cover
Feats: Sharpshooter, Crossbow Expert
Favored weapon: Hand crossbow
Favored Spells (in order of importance): Haste, Mage Armor, Shield, Misty Step, 7 more evocation or abjuration wizard spells of your choice (you'll rarely be casting them).
Rationale: In descending order of importance, the three factors you need for maximum ranged weapon damage dealing are:
- Multiple attacks
- Accuracy & Damage Bonus (about equal: both come from Dex)
- Base Damage (weapon's dice)
Multiple attacks are almost always the most important feature, because an increase in accuracy (say, the 2 point increase from the fighter's "archery" style) will grant you at best a 10% overall boost in damage, while a boost in number of attacks will grant you at least a 20% boost in damage (going from 5 attacks to 6, which usually can only happen at 20th level anyway).
With that in mind, you're going to want the following build:
- 13 levels in Eldritch Knight: 11 for 3 standard attacks. At level 13, trade in the spell you gained at 8th level for "Haste", and get another single weapon attack (4 per round total so far).
- At level 4, take crossbow expert feat. Now, according to sage advice (http://dnd.wizards.com/articles/features/sageadvice_feats), you will be able to use your bonus action for another hand crossbow attack. Although the hand crossbow has the lowest damage dice of the martial ranged weapons, this feat makes it the most damaging in most circumstances. (5 attacks per round).
- At level 6, take sharpshooter. Now, you can shoot your hand crossbow just as well up to 120 feet (and since most combat in a dungeon crawl happens within 100 feet, you're golden). Also, as long as your target's AC is less than 22, you always want to take the -5 to roll for +10 to damage.
Your remaining two attribute increases should got to getting a 20 dexterity. So far we're up to: 5 attacks per round, expending nothing other than a 3rd level spell slot (2 per day available) and ammunition. Each attack does 1d6+15 damage, or 18.5 damage per successful attack. That's (averaging out the rolls) a whopping 92.5 damage per round, without even using action surge! Even more amazingly, you could still be dealing 41 damage on a turn in which you are DODGING (haste action + bonus action attacks)!
Even without haste, we still could be doing 74 damage per round with the hand crossbow, expending no resources other than bolts.
For the final two levels, there are a couple of options; but probably the best one is to take two levels of Rogue. You'll get an extra 1d6 per round from sneak attack, and cunning action (which, although it would lose one weapon attack, would allow you to disengage, dash, or hide as a bonus action: it'll give you considerable versatility on the battle field, and allow you to easily keep your distance). Also, you could get expertise in stealth and acrobatics, which will be a huge boon if you're hoping to scout or hide in combat, or avoid being grappled. Our damage total (without action surge) is now up to 96 damage per round. If you wanted to Haste more often rather than do a bit more damage (and losing some battlefield mobility), you could take 2 levels in sorcerer instead, allowing you 3 castings of haste automatically, and the option to trade in lower level spell slots for a possible 2 more.
The Halfling's bonus to dexterity is essential, but you could get this from other races. A real benefit is the +1 bonus to constitution. It may not look like much, but this build is very much about maintaining the Haste, and has no attribute boosts to spare. If you take this build, DC 10 concentration saves (which is what most attacks will incur if they hit you; only attacks dealing 22 or more damage will up this difficulty) will only fail on a natural 1: and because of Halfling's "Lucky" trait, this means the standard concentration save will only fail 1 in 400 times. Also, the Halfling ability to move through the space of medium hostile creatures makes this build insanely mobile. If you went with 2 levels of Rogue, even if your character was completely surrounded by (medium sized) guards, you could Disengage (cunning action), Dash 45 feet (Haste dash action, speed doubled, five feet of difficult terrain for moving through an enemy's space), make three attacks (action), then move up to 50 feet more, all without incurring any opportunity attacks.
For your first level spell gained at level 3, I'd suggest Misty Step. You should pick up mage armor right away at level 3. With mage armor and Haste activated, you'll have an AC of 20 (13+5 from dex+2 from Haste), before you even take cover (which you should be doing as much as possible as a ranged character). This will make your standard AC between 22 and 25. If you pick up Shield at level 5, you can even bring this up to 30 for a round, in REACTION to being hit (which could cancel the hit in question) at the expense of a first level spell slot.
There are other options that make for powerful ranged damage dealers at this level (Level 10 bard with swift quiver and heavy crossbows will fire 4 times per round, and ranger5/rogue* beats out fighter at most levels). But this build has a slight (or major) numerical advantage over all of them I've been able to calculate at precisely level 15. One last consideration: if you went Fighter 14, Rogue 1, you'd get the same max damage, lose the cunning action, and get access to one 3rd, 2nd, or 1st level Wizard spell of your choice. Mirror image alone might be worth this: but it all depends on how much flexibility you want on your turn. Personally, I'd go Rogue (cunning action is fun and useful).