Baking and Rendering
Before Rendering, we need to bake the simulation. Go to Physics properties
of the plane. Under cloth Cache
, click on Bake
.

When the cloth is finished baking. Apply Materials to the flag and the pole.

Add a floor plane and add some lights.

For faster rendering, in the Render properties, choose the Render Engine
to be Eevee. Under sampling choose the Render Sample
to 15
.

Go to Output properties
, for animation, change the File Format
to FFmpeg video
.

In the output options, choose the destination where you want to save the animation.
To render the animation, click Render > Render Animation
.

The final render will look like this.