In Age of Empires II, projectiles could be avoided by moving units out of range before the projectile landed. This is before the "ballistics" upgrade which makes projectiles ore accurate. Thus, a character (or an enemy) can consider that it is being attacked by a ranged unit and try its best to avoid projectiles while getting within melee range. Ballistics (pistols, heavy crossbows arbalests) would not be as "in-accurate" but would have longer recovery times as they did in AoE2.
Some games utilize a bonus to hit when a melee character is faced against a ranged character (allowing a melee character to easily hit a ranged character when they catch up to them). So for example, if a ranged archer is caught by a melee fighter, the archer could get -10 to Defense, the melee character would get +10 to accuracy.
DoTA2 has what is called "turn rate", which is is the speed at which a unit can turn, measured in radians/sec and normalized between a decimal from 0 - 1. Every unit has a base turn rate, which can be lowered by some abilities. The vast majority of heroes have a turn rate between 0.4 and 0.6. Ranged heroes generally have a lower turn rate to minimize kiting (but not to completely counter it). In this way, melee characters have a chance to catch up to ranged characters and land a few attacks.
Furthermore, in DoTA2 ranged heroes have lower base damage, health, gain less experience for killing mook creatures (creep), have some items give better bonuses to melee heroes, and have longer animation times before an attack is completed (dealing damage) as compared to melee heroes.
League of Legends was not mentioned because they re currently going through an overhaul of how to fix their melee/ranged heroes and have not found a great solution to their problem. As such, more players play ranged heroes than melee ones. I was not able to find enough information to give this a fair explanation.
In Starcraft, melee heroes generally have more health than ranged ones (25-30%). Slower units hit harder than fast ones.
http://tvtropes.org/pmwiki/pmwiki.php/Main/TacticalRockPaperScissors
http://forums.amplitude-studios.com/showthread.php?41026-Best-Way-to-Balance-Ranged-and-Melee-Units/page2