1) Are they used to guard against movement in the ground, roof, or both?
Their primary usage would be in vertical stacks that would be subject to expansion/contraction forces.
2) Where are they placed...at the bottom of a stack?
Wherever the expansion/contraction would occur, namely between any two points that are securely anchored so that any E/C forces would create a stress.
3) Should every stack have an expansion joint?
No. Their usage is normally limited to long risers in tall buildings, and even then the E/C is usually accomodated by offsetting the stack periodically.
To answer your unasked question. About the only houses that need expansion joints are log cabins that are subjected to shrinkage as the logs age. In that case, the floor to floor dimension will change over time and if there is no provision to handle it, the upstairs toilet would be lifted off the floor and the piping would have to become distorted. (Doors and other items also have to have provision for the shrinkage, because any wall openings will also get shorter.)