Section 20.2 in Matter and Interactions (4th edition)
Since we deal with currents on a daily basis in all of electronics, it is particularly important and relevant to consider the force on a current-carrying wire. These notes will step through how get from the magnetic force on a single moving charge to the force on a current.
If we think about a long straight wire with a steady state current, we can model this simply as many moving charges in a wire. When that wire is placed in an external magnetic field (from some other source - either another wire or permanent magnet), each of the moving charges would feel a force. Collectively, this results in a net force on the wire by the magnetic field.
To calculate this magnetic force on the wire, we follow a very similar set of steps. We can start by dividing the wire into little chunks and only thinking about the amount of moving charge in that little chunk. Since we are interested in the small bit of force on the little bit of moving charge in that piece of the wire, we could write this as: $$d\vec{F}= dq \vec{v}\times\vec{B}$$ where $dq$ is the small amount of charge in the little piece of the wire, $\vec{v}$ is the speed with which that small bit of charge is moving (units of $\frac{m}{s}$, and $\vec{B}$ is the external magnetic field (units of $T$).
However, especially for wires, it is often more useful to think about the current in that piece rather than the individual moving charges. So to rewrite this in terms of current, we start by rewriting the velocity in terms of the length and time (just like we did before) $\vec{v}=\frac{d\vec{l}}{dt}$. So we get the force from the small piece of the wire to be: $$d\vec{F}= dq \frac{d\vec{l}}{dt}\times\vec{B}$$
Then, since $dt$ represents a small amount of time, $dl$ represents a small amount of length, and $dq$ represents a small amount of charge, we will treat these as independent and rewrite: $$dq \cdot \frac{d\vec{l}}{dt} = \frac{dq \cdot d\vec{l}}{dt}=\frac{dq}{dt}\cdot d\vec{l}$$
This means the magnetic force on the small piece of wire can be written as: $$d\vec{F}= \frac{dq}{dt}d\vec{l}\times\vec{B} = I d\vec{l} \times \vec{B}$$ using the fact that $\frac{dq}{dt}$ is the definition of conventional current (the amount of charge passing a point per second).
This means that the small amount of force on the wire is given by: $$d\vec{F}= I d\vec{l} \times \vec{B}$$ where I is current in the little piece of the wire, $d\vec{l}$ is the little bit of length that you are interested in (and it is a vector so it points in the direction of the current), and $\vec{B}$ is the external magnetic field that the wire is in.
Note: that the force is still given by the cross product between the $d\vec{l}$ and the $\vec{B}$, so the force on the piece of wire is still perpendicular to both the direction of the moving charges ($d\vec{l}$) and perpendicular to the magnetic field ($\vec{B}$). This means we can still use the right hand rule to figure out the direction of the $d\vec{F}$.
Now that we have the magnetic force on a small piece of the wire, we can find the total force on the wire from the external magnetic field by adding up the contributions from each little piece of the wire. Since we have the small bit of force from the small bit of wire, we will add these using an integral: $$\vec{F}_{wire}= \int_{wire} d\vec{F} = \int_{l_i}^{l_f} I d\vec{l} \times \vec{B}$$ Here we want to pick the limits of the integral to be from the starting point of the wire ($l_i$) to the end of the wire ($l_f$) so we are adding up over the whole length of the wire. This form of the force will always work to find the magnetic force on the whole wire - we have not made very many assumptions so far in coming up with this equation.
However, if we do make a few assumptions we can simplify this equation significantly. We will start by assuming that the current in the wire is constant and in a steady state. This allows us to pull the current out of the integral as a constant, leaving: $$\vec{F}_{wire}= I \int_{l_i}^{l_f} d\vec{l} \times \vec{B}$$
Next we want to simplify the cross product in terms of the magnitude of the two vectors and the angle between them ($\theta$); however, this will give us only the magnitude of the magnetic force, rather than the magnitude and direciton.
$$|\vec{F}_{wire}|= I \int_{l_i}^{l_f} B \cdot dl sin(\theta)$$
If we assume that the wire is straight (no bends or curves), then the angle $\theta$ between the length of wire and the magnetic field will be constant, so we can pull the $sin(\theta)$ out of the integral. If we also assume the magnetic field is constant along the length of the wire, then we can also pull the $B$ out of the integral. $$|\vec{F}_{wire}|= I B sin(\theta) \int_{l_i}^{l_f} dl$$ This leaves only the integral of $dl$. When we take the integral of $dl$ over the whole length of the wire, we are left with the total length of wire that we are considering. So we get: $$|\vec{F}_{wire}|=IBLsin(\theta)$$
where |$\vec{F}_{wire}$| is the magnitude of the force on the whole wire, $I$ is the current through the wire, $B$ is the external magnetic field, $L$ is the length of the wire, and $\theta$ is the angle between the magnetic field and the length of the wire. Remember though that this equation is only good for straight wires with constant current that are in a constant magnetic field - because of all the assumptions that we made to get to this point.
To find the direction of the magnetic force, we will need to use the right hand rule. Just like we did with the moving charge, you point your fingers in the direction of the moving charges (or rather in the direction of the current/$d\vec{l}$), then curl your fingers in the direction of the external magnetic field. Your thumb then points in the direction of the force.
For example, if you have a wire with current going in the $+\hat{y}$ direction that is placed in a magnetic field that points out of the page, then the force on the wire would point down (in the $+\hat{x}$ direction).