To produce an animated GIF, you need to place each frame of the animation on a separate layer - it's pretty much the digital version of the old flip books that I'm sure you're familiar with.
One of the features available to you when you export your final image as a GIF is the ability to make the animation "loop", i.e. once you reach the end of the animation, it automatically starts to play again from the beginning, and thus repeats ad infinitum.
If you're not familiar with the concept of layers, start reading about them here:
It's not clear why you are asking these questions, but if Phil is on the right track, you might be interested in the automatic animated gifs that Elements 2021 can create. They can be created via the Enhance>Moving Photos editor. There are several different types of movement that can be generated, both in 2D and 3D. Here is an example:
I had to reduce the size of the gif to attach it to this post. The original is smoother and doesn't have the abrupt end. The original had 118 layers, all of them created automatically by the program's editor, as you can see in this screenshot:
Of course, it is possible to create your own animated gifs. Here is a crude example of a gif that I created from a couple of smartphone photos, using 13 layers: