An $m\times n$ matrix $A$ (with coefficients in a field, such as $\mathbb{Q}$ or $\mathbb{R}$) has a right inverse if and only if $m\leq n$ and $\mathrm{rank}(A)=m$. An $m\times n$ matrix has a left inverse if and only if $n\leq m$ and $\mathrm{rank}(A)=n$.
In the first case, you can think of $A$ as representing a surjective linear transformation $\mathbb{F}^n\to\mathbb{F}^m$. To find an inverse to a surjective function, you just need to find a pre-image to each element of a basis for $\mathbb{F}^m$ and define the map using them.
That means, finding a solution to $A\mathbf{x}_i=\mathbf{e}_i$, where $\mathbf{e}_i$ is the $m\times 1$ vector that has a $1$ in the $i$th component and zeroes elsewhere (any solution will do). Then the matrix whose columns are the $\mathbf{x}_i$ will be a right inverse of $A$.
This can be done all at once by doing row reduction of the matrix $(A|I_m)$, where $I_m$ is the $m\times m$ identity. For instance, here, $$\begin{align*} \left(\begin{array}{ccc|cc} 1&2&3&1&0\\ 4&0&5&0&1 \end{array}\right) &\to \left(\begin{array}{rrr|rr} 1&2&3&1&0\\ 0&-8&-7&-4&1 \end{array}\right)\\ &\to\left(\begin{array}{rrr|rr} 1&2&3&1&0\\ 0^{\vphantom{2^2}} & 1 & \frac{7}{8} & \frac{1}{2} & -\frac{1}{8} \end{array}\right)\\ &\to\left(\begin{array}{rrr|rr} 1 & 0 & \frac{5}{4} & 0 & \frac{1}{4}\\ 0^{\vphantom{2^2}} & 1 & \frac{7}{8} & \frac{1}{2} & -\frac{1}{8} \end{array}\right). \end{align*}$$ So, the solutions to $A\mathbf{x}=\mathbf{e}_1$ are of the form $$\begin{align*} x&= -\frac{3}{8}t\\ y&= \frac{1}{2} - \frac{7}{8}t\\ z&=t \end{align*}$$ and the solutions to $A\mathbf{x}=\mathbf{e}_2$ are of the form $$\begin{align*} x&= \frac{1}{4} - \frac{5}{4}s\\ y&= -\frac{1}{8} - \frac{7}{8}s\\ z&=s \end{align*}$$ Thus, the right inverses of $A$ are the matrices of the form $$\left(\begin{array}{cc} \frac{-3}{8}t & \frac{1}{4}-\frac{5}{4}s\\ \frac{1}{2}-\frac{7}{8}t & -\frac{1}{8} - \frac{7}{8}s\\ t & s \end{array}\right).$$ Setting $s=t=0$ gives you the matrix from Michael Biro's answer.
Left inverses are similar, and left as a thought exercise for the reader.