  We develop a microscopic theory of multipole interactions and orderings in
5$d^2$ transition metal ion compounds. In a cubic environment, the ground state
of 5$d^2$ ions is a non-Kramers $E_g$ doublet, which is nonmagnetic but hosts
quadrupole and octupole moments. We derive pseudospin one-half Hamiltonians
describing various spin-orbital exchange processes between these ions. Direct
overlap of the $t_{2g}$ orbitals results in bond-dependent pseudospin
interactions similar to those for $e_g$ orbitals in manganites. The
superexchange process via oxygen ions generates new types of pairwise
interactions. In perovskites with 180$^\circ$ bonding, we find nearly equal
mixture of Heisenberg and $e_g$ orbital compass couplings. The 90$^\circ$
superexchange in compounds with edge-shared octahedra is most unusual: despite
highly anisotropic shapes of the $E_g$ wavefunctions, the pseudospin
interactions have no bond dependence and show instead a hidden SU(2) symmetry,
which equally supports quadrupole and octupole orders. We consider the $E_g$
pseudospin models on various lattices and obtain their ground state properties
using analytical, classical Monte Carlo, and exact diagonalization methods. On
the honeycomb lattice, we observe a duality with the extended Kitaev model, and
uncover a critical point where the quadrupole and octupole states are exactly
degenerate. On the triangular lattice, an exotic pseudospin state,
corresponding to the coherent superposition of vortex-type quadrupole and
ferri-type octupole orders, is realized due to geometrical frustration. We also
consider Jahn-Teller coupling effects and lattice mediated interactions between
$E_g$ pseudospins. Possible implications of the results for recent experiments
on double perovskite osmates are discussed, including effects of local
distortions on the pseudospin wavefunctions and interactions.
