The GIF format can use two methods to display the frames in an animation. The “replace” method simply replaces the current frame with the next one. The “combine” method merges the next frame onto the current one, so transparent areas will show through. This article has a good explanation of the difference (although it’s for GIMP). I wanted to save a GIF from Photoshop with the combine method, but could not figure out where that setting was.
After some thorough googling I stumbled on this article which explains how to do it. In Photoshop it’s called “dispose” or “do not dispose”. To get to it you need to open the timeline window (Window – Timeline). Then right clicking on any frame brings up a context menu where you can choose between the two methods.