Many other answers have covered lights for seeing on the ground, which are invaluable during taxiing, takeoff and landing. They've also covered how most obstacles (like other planes) should be illuminated to be seen (according to Advisory Circular 70/7460-1L in the US). I'm going to cover the other ways that an aircraft can "see" what's around it. IFR navigation and avoiding controlled flight into terrain are related topics.
The answer depends somewhat on whether we're talking about visual flight rules or instrument flight rules. Visually spotting lit obstacles is far more important if you're not instrument-rated. Of course, planes don't have to visually see obstacles to avoid them. Properly trained pilots can fly IFR in zero visibility, so they have plenty of tools to identify threats ahead that they can't see.
Charts
Aircraft can fly in low visibility situations where even lights won't do you much good. This is done in large part using careful navigation and reference to charts. Sectional charts are required to show peaks, towers, and other obstructions as shown in the legend below. Approach plates and procedures may also list smaller obstacles particularly close to the runway.
You'll notice that the sectional below has the obstructions marked, as well as a big 07 in the right hand bottom. That 07 means that the highest terrain or obstruction in the right hand box on the image below (basically everything east of Logan Intl Airport, outlined by straight lines with tick marks) is 700 feet, including a small margin and rounding, so if you're flying safely above that altitude you can avoid obstacles.
Synthetic Vision
A new emerging technology is synthetic vision, as mentioned in SierraSkyport's answer. This system combines precision location information with very detailed terrain and obstacles databases to provide a view of the surrounding area.
This is sometimes combined an enhanced vision system with an near-IR camera to see in darkness and through fog and clouds, and this clear camera-based view of the surrounding area is often overlaid on the center of the synthetic vision display. I've seen a near-IR camera in action and you can actually make out features like the edge of the runway and buildings, even in very low visibility.
(Image by Honeywell, provided with Permission)
TCAS and ADS-B
Your major obstacles when above the ground are other aircraft (I don't know what else you'd hit in the air, meteorites?) Any aircraft equipped with a mode-C or mode-S transponder is "visible" to a plane with TCAS, and the TCAS system will provide traffic alerts for nearby aircraft (and guidance for how to resolve the conflict if the intruder gets close enough and it's a TCAS II system).
ADS-B in also provides traffic information for any nearby aircraft equipped with ADS-B out (which thanks to mandates is becoming very common). ADS-B is often supplied integrated into a mode-s transponder, but this is not always the case, so you could have ADS-B out and ADS-B in but not a TCAS-compatible transponder.
TAWS, GPWS, and Radar altimeter
For avoiding the ground these systems provide some information to avoid a controlled flight into terrain. Terrain awareness warning systems (TAWS) and ground proximity warning systems (GPWS) (the two are sometimes synonymous) are now required by the FAA on all large turbine and turbojets. These systems warn if you're descending too fast, below the glideslope, or flying too close to terrain, based on a radar altimeter. Even without this system, you may have a radar altimeter to monitor your height above terrain.
Radar
Weather Radar (or Stormscopes) and ADS-B both provide excellent information about weather ahead that you can't see. Most non-military aircraft do not have primary radar for seeing things other than weather.
ATC
In a worst case scenario ATC has tools like minimum safe altitude warning systems and short-term conflict alerts and may alert you if you're about to run into terrain or another aircraft. As far as I understand, this isn't supposed to be your primary method of avoiding obstacles though, even in IFR conditions.