Vision

Vision describes what a unit can and can't see from its current location and state. Places a unit cannot see are filled with the Fog of War, a dark mist that hides units inside of it. Invisible units can't be seen even when outside of the Fog of War, unless they are spotted by a unit with True Sight. Units can't see through trees or to higher elevations - the only exceptions to this rule are flying units, who have unrestricted Vision, and Night Stalker with an Aghanim's Scepter.

All units on your team share Vision, which means that if a unit can see through the Fog of War, all allies can as well. This also applies to Lane Creeps and other controlled Creeps.

Fog of War
All areas outside of friendly Vision become Fog of War. Any non-friendly units within the Fog of War cannot be seen or targeted (it is, effectively, invisibility), however they can still be hit by non-targeted spells. To reveal units in the Fog of War, an allied unit must gain vision in that area. Observer Wards will provide vision in an area to their team.

If a unit in the Fog of War attacks an enemy that does not have vision of them, they will be revealed temporarily.

Elevation and Trees
Units cannot see areas that are on higher elevations than them, while units on higher ground receive unrestricted vision below. Additionally, any ranged units attacking an enemy on higher elevation has a 25% chance to miss their target. Trees also block vision, and can be used to escape enemies by running through small gaps in them (known as "Juking"). When Trees are cut down or destroyed, they no longer block vision.

Day and Night
Most units have different vision ranges for the day and night cycles. Generally, units see a lot farther during the day than they do at night. Most heroes have 1800 units of vision during the day, and 800 at night, though there are several exceptions. This makes ganking a lot more viable at night, because Heroes can get much closer without being detected.

Below is a table of all exceptions to the 1800/800 rule:

Invisibility
Invisible units and Heroes do not appear on their opponent's screen or minimap, and cannot be targeted directly. Invisible units can still be affected by some non-targeted spells, such as area attacks. However, certain abilities do not affect Invisible units, such as Earthshaker's Echo Slam. Heroes can become Invisible by using skills, the items Shadow Blade or Smoke of Deceit, or by activating a Rune of Invisibility.

Generally, Heroes remain Invisible until their Invisibility duration runs out, or they perform an action, such as attacking an enemy or using an item. Invisible units can still be revealed by units with True Sight.

Disjointing
All ranged attacks and most projectile abilities are disjointed by Invisibility. If a Hero is targeted with a ranged attack, and goes invisible while the projectile is in flight, it will not damage or affect them. Some projectile abilities will still affect invisible Heroes, and some will have other effects entirely.

True Sight
True Sight allows a unit to see Invisible enemies that are nearby. All Towers have a passive true sight built in, including the Fountains and Ancients. Heroes can obtain True Sight by purchasing a Gem of True Sight, or can use Sentry Wards or Dust of Appearance. Sentry Wards grant True Sight around themselves, while Dust of Appearance causes Invisible units to be revealed for its duration. Necronomicon Warriors also have True Sight at Level 3.