This is a question I brought up with my group and although I have made a ruling, I'm hoping to get a more authoritative answer (Sage Advice perhaps?).
The rules for mounted combat don't seem to specify how targetting works with the Attack Action. I've summarized the mechanics from PHB 198 below, with the final rule italicized because it is the subject of this question:
A mount is:
- A willing creature
- At least one size larger
- has appropriate anatomy to ride
Mounted and Dismounted:
- If within 5 feet of a mount, mounting or dismounting takes half your movement speed
- If mount is moved against will or you are made prone, DC 10 Dexterity or become dismounted and prone within 5 feet of mount.
- If the mount becomes prone you become dismounted within 5 feet of the mount. You become prone as well unless you spend your reaction.
Actions and Movement:
- A controlled mount must be a trained or domesticated creature, and they match your initiative while mounted. You may move the mount using its speed, and may only have it Dash, Disengage, or Dodge when it acts. Controlled mounts may move and act on the turn they become mounted.
- Independent mounts must be intelligent creatures and act independently, retaining their initiative order, movement, and full ability to act (presumably actions, bonus actions, reactions, etc.)
- If a mount provokes an opportunity attack while mounted, the attacker can target the mount or rider.
The targetting rules of an Attack of Opportunity is specified, but can an Attack action also target the rider when only the mount is in range?
The Mounted Combatant Feat suggests that by default attacks may optionally target the mount, but leaves it unclear if the rider may be targetted whenever the mount may be targetted:
- "You can force an attack targetted at your mount to target you instead"
Best Answer
In general, riders and mounts can be targeted like any other creature
The rules for Mounted Combat don't specify how targeting works for the Attack action (or any other action) because targeting riders and mounts is no different that targeting any other creature, with the exception of opportunity attacks.
Whether you can target either, neither, just the rider, or just the mount has nothing to do with their status as rider and mount, rather it depends on many other circumstantial factors, the most common of which are by far range and total cover.
From Making an Attack:
From Total Cover:
For example:
Opportunity attacks
The rules for Opportunity Attacks state that:
And that:
The rules for Controlling a Mount also state that:
In short, a rider never provokes your opportunity attack when it moves using its mount's movement. But if a mount provokes your opportunity attack, then you can choose to target the rider instead of the mount, despite the fact that the rider did not provoke said opportunity attack.
However, this does not mean you can target a rider regardless of all other factors such as range or total cover. For example, opportunity attacks occur retroactively just before the target leaves your reach, but if the rider was never within your reach to begin with, then you can't possibly attack the rider.