Although the title is about Lie algebras, the question body mentions Lie groups, and my answer will deal more with these. As mentioned in other answers, Lie groups show up frequently in geometry as groups of symmetries of geometric objects. For example, given a manifold $M$ we can sometimes find a Lie group $G$ that acts on $M$ in some interesting fashion, and it is then not unreasonable to hope that this action might yield information about both $G$ and $M$.
Let's look at something a bit more specific. Suppose we have a compact connected Lie group $G$ acting 'in some nice fashion' on a manifold $M$. Typically what one does in this case is break up $M$ into $G$-orbits, and then study each piece individually. Each orbit will be a homogeneous space $G/H$ of $G$, where $H$ is the stabilizer of some point in the orbit. The space $G/H$ is very symmetric-looking, and one might try to exploit the symmetry to gain some structural information. What we have done -- roughly speaking -- is cast aside the manifold and are now working primarily with the group. Of course an interesting special case is when the action of $G$ on $M$ is transitive, i.e. when there is only one $G$-orbit in $M$ so that $M=G/H$ is itself a homogeneous space. There is so much to say about manifolds of the form $G/H$ that I will restrict myself only to two things.
1)
The computation of the (real) cohomology of $G/H$ becomes a problem involving the Lie algebras $\mathfrak{g}$ and $\mathfrak{h}$ of $G$ and $H$, which are linear algebraic objects! In particular, if $H$ is closed and connected in the compact and connected Lie group $G$ then the cohomology ring $H^\ast(G/H;\mathbb{R})$ is isomorphic to the relative Lie algebra cohomology ring $H^\ast(\mathfrak{g}, \mathfrak{h};\mathbb{R})$. For instance if $H$ is the trivial subgroup, we obtain the isomorphism $H^\ast(G;\mathbb{R}) \cong H^\ast(\mathfrak{g};\mathbb{R})$ mentioned in the OP; and indeed, computing $H^\ast(\mathfrak{g})$ is a much more tractable problem. Another interesting special case is when $H$ is a maximal torus in $G$, but I will not say more about this here...
2)
Vector bundles over $G/H$ are related to the representation theory of $G$. Strictly speaking, this is only true of equivariant vector bundles, i.e. vector bundles $\pi \colon E \to G/H$ where $G$ acts on the total space $E$ in a way that respects its action on the base $G/H$: that is, we ask that $\pi(ge) = g\pi(e)$ for all $g \in G$ and $e\in E$ and that translation between fibers $E_x \to E_{gx}$ be linear. The fiber lying over the trivial coset in $G/H$ is then seen to carry a representation of $H$. Is there an action of $G$ lurking around? Yes: $G$ acts on the sheaf cohomology $H^\ast(G/H, V)$! Thus we can relate the cohomology of $H^\ast(G/H,V)$ to the representation theory of $G$.
A very important special case is when $H$ is a maximal torus $T$ and $V$ is an equivariant (holomorphic) line bundle $L \to G/T$ (let's not fret about the "holomorphic" bit). (There is a miraculous fact that if $G$ is simply connected then every holomorphic line bundle over $G/T$ is automatically equivariant. In particular, this means that even if $G$ isn't simply connected, then we always get an action of the Lie algebra $\mathfrak{g}$ of $G$ on $H^\ast(G/H,L)$, even if there is no corresponding action of $G$. In other words, we can use the representation theory of $\mathfrak{g}$ to study $H^\ast(G/H,L)$.) There is a very explicit description of $H^\ast(G/T, L)$ in terms of the representation theory of $G$: it turns out that either $H^\ast$ vanishes completely, or else it is nonzero in a single degree $q_L$, in which case $H^{q_L}(G/T,L)$ is an irreducible representation of $G$. (This can be made much more precise; in particular, there is an explicit description of $q_L$ and of the resulting irreducible representation in terms of weights. The key phrase here is "Borel--Weil--Bott theorem.'')
Here is a concrete example. If $G = \operatorname{SU}(2)$ and $T$ is its diagonal subgroup, then $G/T = \mathbb{C}P^1$, and one can use the Borel--Weil--Bott theorem to describe the cohomology groups $H^\ast(\mathbb{C}P^1, \mathcal{O}(n))$. For instance, the fact that $H^0(\mathbb{C}P^1, \mathcal{O}(n)) = \text{Sym}^n(\mathbb{C}^2)$ (for $n \geq 0$) comes from the fact that $\text{Sym}^n(\mathbb{C}^2)$ is the irreducible representation of $\operatorname{SU}(2)$ of highest weight $n$.
There is another obvious reason why Lie groups are important in geometry: they are themselves geometric objects (namely, manifolds)! So you cannot expect to say something about general manifolds that cannot be said about them. Since Lie groups are a relatively well-behaved class of manifolds, one can use them as a test case of or a launch pad to more general results. The same can be said about homogeneous spaces $G/H$. For example, general results like the Atiyah--Bott fixed point foruma and the Atiyah--Singer index formulas when applied to $G/T$ (where $G$ is a compact and connected Lie group and $T$ is a maximal torus) are closely related to the Weyl character formula for $G$.