The simple machine present in a flagpole is a
pulley.
Yes, a pulley can change the direction of the applied force. A pulley consists of two ends of a string. When one of them is pulled downward, the other end is pulled upward. In this way, a downward effort applied on one end of the pulley can cause an upward movement in the object tied to the other end of the pulley. A flag is hoisted using the same mechanism.