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 terrainavoiding controlled flight into terrain are related topics.
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 systemenhanced 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)
In a worst case scenario ATC has tools like minimum safe altitude warning systems and short-term conflict alerts and may alert youmay 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.