Direct edges of undirected graph so that all indegrees are even
Orient all edges in an arbitrary fashion, and add a $0/1$ variable $x_{u,v}$ for each edge $(u,v)$, with the following meaning: $x_{u,v} = 0$ means that we use the orientation $u \to v$, and $x_{u,v} = 1$ means that we use the orientation $u \gets v$. The parity of the indegree of $u$ is equal to
$$
\sum_{(u,v) \in E} x_{u,v} + \sum_{(w,u) \in E} (1 + x_{w,u}) \pmod{2}.
$$
Let $p_u$ be the parity of the number of edges of the form $(w,u)$. Then we can formulate the task as follows:


  Assign $0/1$ values to the edges so that the sum of weights of edges adjacent to $u$ is $p_u$ (mod 2).


As an example, consider your sample graph, with edges
$$
(1,2), (1,3), (2,4), (3,4).
$$
We have $p_1 = 0$, $p_2 = 1$, $p_3 = 1$, $p_4 = 0$. We are looking for a solution (mod 2) of the following system:
$$
\begin{align*}
&amp;x_{12} + x_{13} = 0 \\
&amp;x_{12} + x_{24} = 1 \\
&amp;x_{13} + x_{34} = 1 \\
&amp;x_{24} + x_{34} = 0
\end{align*}
$$

One such solution is $x_{12} = x_{13} = 0$, $x_{24} = x_{34} = 1$. This is exactly the solution that you describe.

If you sum all equations, then all the edges cancel, and you get $\sum_u p_u = 0 \pmod{2}$. This gives a necessary condition for the existence of a solution. It turns out that this condition is also sufficient, assuming the graph is connected (otherwise, you need a similar condition for each connected component). A solution can be found using linear algebra modulo 2.

This is related to the so-called Tseitin contradictions in proof complexity, which correspond to assignments of the weights $p_u$ for which no solution exists.