Current in a circuit with diodes
Why in the first one it's neglecting \$i_2\$?


Because if you take \$V_i\$ as an independent variable, \$i_2\$ doesn't change \$V_o\$. \$V_o\$ depends only on \$V_i\$, R, and R1. 


  How can I know when to consider the second current and when not?


You can calculate what the second current is (\$V_i / R_2\$ in this case) and then see whether you ever use that information in calculating whatever final result you're going for (\$V_o\$ in this case).


  why the current isn't neglected in every parallel circuit like in these two.


Because sometimes it matters. If the source providing \$V_i\$ had an internal resistance, for example, then \$i_2\$ would contribute to the drop across that internal resistance, so you'd have to know it to find the output voltage.