There are a lot of different types of valves out there so its hard to answer your question simply, but here are a couple videos which show valves.
Close center spool valve
https://www.youtube.com/watch?v=vY_bguSNgSc
Rotary valve (not the best animation but might help)
https://www.youtube.com/watch?v=th_eOkTh9yE
Basically you are opening one port exit to the pressure from the pump while connecting the other port to the return to the tank. A spool valve does this by sliding the 'lands' (bigger parts) back and forth and a rotary valve does it by turning the cutouts so they line up with the ports. Hope this helps...