In simplified terms, envision a flat horizontal 10-yard line. Now angle it slightly up, still 10 yards long. Now you don't travel as far horizontally but more vertically. In the same vein, angle that upward line back down and you travel more horizontal distance but don't go as high up.
In other words, DI lets you shift the angle you're knocked at in order to potentially avoid crossing either a horizontal or vertical blast line. But if you DI badly, you might send yourself even closer to the line or to a different blast line and kill yourself.
This picture from ssbwiki illustrates the difference perfectly:
http://www.ssbwiki.com/images/9/96/Directional_influence_example.png
However, Smash 4 introduced another type of DI, vectoring, which let players directly fight against the amount of knockback you receive by inputting the opposite direction. It doesn't work for vertical knockback anymore as of 1.0.4, but apparently still exists for horizontal knockback. This means for the purposes of surviving, you should always try to DI left or right, so that you'll directly fight against horizontal knockback, and do the angling thing described above against vertical knockback. That is separate from trying to DI out of combos or away from followups, of course, as that's all up to the flow of the battle.
Also, I'm not sure about this part but against certain attacks that aren't going to make you cross the blast line but will send you at an inconvenient angle, it might still be worth doing an upward angle to make your subsequent recovery easier.