On a sphere, for instance, the geodesics are the great circles. The shortest path from point A to point B on a sphere is given by the shorter piece of the great circle passing through A and B. Note that if A and B are antipodal points (like the North pole and the South pole), then there are many shortest paths between them.
In the theory of general relativity, particles travel along geodesics through space-time, and so their paths depend on the space-time's curvature. This curvature is in turn determined by the energy and mass distribution; this is the content of the Einstein equation.
In general, geodesics can be defined for any Riemannian manifold. Every shortest path from A to B yields a geodesic, but the converse is not always true, as the example of a sphere shows. Furthermore, it is possible that there are no shortest paths from A to B, but there are geodesics connecting A and B. An example of this is the sphere with a point between A and B removed.
See also geodesic dome.