There are a lot of method to make a motor driver. We can have a H bridge using transistors, using Operational Amplifier and power transistors or rather an Intergrated Circuit we call it Motor Driver IC. Its L293, able to control 2 motors. Each side of motor will have an Enable, Input 1, Input 2, Output 1, and Output 2. Motor will be connected at Output 1 and Output 2.
If Input 1 is High, Output 1 will be high and vice versa, so does Input 2 and Output 2. So to run a motor, we can put High in Input 1 and Low in Input 2, current will flow from Output 1 to Output 2. TO reverse the direction, we will put Input 1 with Low and Input 2 with High, current will flow from Output 2 to Output 1.
To control the speed, we will send PWM to the Enable. For lower speed of motor, we will use lower duty cycle while for higher speed, we will use higher duty cycle.
You can search for the data sheet here.