Considerable Change of Geodesics on Some Surfaces In $\mathbb{R}^2$, beginning with two points $A$ and $B$ and moving $A$ in a continuous manner, the segment $AB$ changes slightly. Look at the figure below:

However it's not the case on some other surfaces, e.g. the geodesic between $A$
and $B$ compared to the one between $A'$ and $B$ on $S^2$, as is shown in this figure:

What's behind this fact? How can the surfaces of the former kind be distinguished from the latter?
Thanks.
 A: Look up conjugate points on Wikipedia. If you had taken any non-antipodal pair of points on the sphere, you would still have been OK. Basically, it's positive curvature together with compactness that are causing your problem.
A: This has to do with the cut locus.  Let $S$ be a surface, and assume that $S$ is geodesically complete, meaning that every geodesic can be defined for all time.  Given a point $B\in S$ and a geodesic $\gamma$ starting at $B$, it follows from general properties of geodesics that there is some $\delta>0$ such that the restriction of $\gamma$ to $[0,\delta]$ is length-minimizing.  If $\gamma$ ever stops being length-minimizing, then there is a time $c>0$ such that $\gamma$ is length-minimizing on $[0,c]$ and not minimizing on any larger interval.  In this case, the point $\gamma(c)$ is called the cut point of $B$ along $\gamma$.   Define the cut locus of $B$ to be the set of all cut points of $B$ along all geodesics.  
The important fact is that the complement of the set of cut points of $B$ is a connected open subset $U\subset S$ containing $B$; and for all $A\in U$, the minimizing geodesic from $A$ to $B$ varies continuously with $A$.  
There is a related notion (mentioned by @Ted) called conjugate points. Intuitively, a point $A$ is conjugate to $B$ along a geodesic $\gamma$ if there's a nontrivial one-parameter family of geodesics that all start at $B$ and end at $A$.  (The actual definition is more complicated than this, but this will give you the general idea.)  There's a theorem that says the cut point along $\gamma$ (if there is one) comes at or before the first conjugate point (if there is one).  
There are a number of powerful theorems that use hypotheses on curvature to draw consequences about conjugate points, and therefore about cut points.  For example, if $S$ is a complete surface with Gaussian curvature everywhere greater than or equal to $1/R^2$ (such as, for example, a sphere of radius $R$ or less), then every geodesic has a conjugate point (and therefore also a cut point) no farther away than $\pi R$.  On the sphere of radius $R$, each geodesic has a cut point  exactly at distance $\pi R$, namely the point antipodal to the starting point.  Thus given a point  $B$ in the sphere, the minimizing geodesic from $A$ to $B$ depends continuously on $A$ as long as $A$ is not equal to the point antipodal to $B$.
