How do simple machines change the direction of force?
Simple machines use a pivot point to modify the magnitude and/or direction of a force.
Forces are vector quantities so they combine as vectors.
Simple machines use a pivot point such as a lever fulcrum or axle bearing to provide a "counteractive" force to combine with the applied force(s) to produce a resultant force, acting in a different direction and/or with a different magnitude to that applied.
The forces must comply with the rules of Newtonian physics,
i.e. if the forces are not in balance then something will be accelerating.
work = force * distance (= energy)
For a lever in balance
Note that there must be a counteractive force acting upwards at the fulcrum if the lever is in balance
Gears, wheels and pulleys use the same principles but allow continuous movement, whereas a lever has a limited range of movement.