Oxalic acid structure
Like ron already stated, the reason for that arrangement is the possibility to form more intermolecular hydrogen bonds. For oxalic acid there are two modifications which depict this quite clearly.


From charge considerations itself it is not obvious, that the periplanar alignment should be better. However one can see, that there might be a little less repulsion. Given here are natural partial charges from NBO/BP86/cc-pVDZ.


A rotational scan reveals that the rotation barrier is just around $7~\mathrm{kJ/mol}$ and the difference between these are just around $2~\mathrm{kJ/mol}$ (BP86/cc-pVDZ). The dihedral angle of $0^\circ$ refers to the hydroxyl moieties being on the same side.


The barrier results mainly from breaking the partial $\pi$ bond between the two carbon centres.


The $\ce{O...H}$ intramolecular distance is around $230~\mathrm{pm}$ and in gas phase and higher temperatures hydrogen tunneling should be also considered.

In aqueous solution, exchange rates between water and oxalic acid are very fast, so that all oxygen atoms should be equal - there is no difference observable at this time scale.
\begin{aligned}\ce{
(COOH)2 + 2H2O &amp;&lt;=&gt; HOOC-COO- + H3+O + H2O\\
               &amp;&lt;=&gt; (COO^{-})2 + 2H3+O\\
}\end{aligned}