Vision

Vision determines how far a unit can see from its current location, flying units have unrestricted vision. All area's outside any friendly units vision, are in the fog-of-war. Units inside the fog-of-war cannot be seen and a friendly unit must move into it to reveal any units in the fog-of-war.

Elevation and Tree's
Units cannot see up elevated areas but units on elevated ground have increased view distance, also ranged units firing up hill have 25% chance to miss. Tree's block all vision and can be used to escape enemies.

Day and Night
During the day units have unrestricted vision, however during the night the majority of units have vastly decreased view-range most heroes have 1800 day vision and 800night vision Exceptions to this rule are:
 * Enchantress 1800/1800
 * Sniper 1800/1000
 * Night Stalker 1200/1800
 * Ancient Apparition 1800/1400
 * Drow Ranger 1800/1700

True Sight
True sight allows units to see invisible units, you can gain true sight by purchasing a Gem of True Sight. A few units with True Sight are:
 * Towers
 * Both Ancient's
 * Sentry Wards