Why is there an electric field in a wire even though it is a conductor?
The electric field in a conductor is zero if the charges are not moving. The electrons do re-arrange themselves to (try to) cancel out the electric field. That is what is happening in an electric wire; there is no contradiction.
The difference between an electric wire that is part of an electric circuit and the same wire isolated in space (when there would be no static electric field inside it) is that there is a source of EMF in the former case which is taking charge from one end of the wire and putting it in at the other end.
If you take a perfect conductor, there cannot be a field across it since if there were, the particles would arrange themselves in a way to cancel out the field right?
Correct, for a perfect conductor, there can be no electric field within the conductor period.
Yet, why does the same not hold true for a wire.
It is true in the electrostatic case. Since, within a conductor, charge is free to move, if there is an electric field present within the conductor, charge will accelerate. Thus, if the configuration is static, there can be no electric field within the conductor. Put another way, if the configuration is not static, there is an electric field within the conductor.
A wire is essentially a long, thin conductor yet electrons do indeed flow so there must be an electric field.
Correct. For example, if there is a steady current through a (non-ideal) conductor, there is a constant electric field within the conductor.
Note that, for an ideal conductor, no electric field is needed to sustain a steady current.
There are already many great answers here, but I'm going to try to directly address a misconception.
It's not that there can't be an electric field inside the conductor. In fact, there must be a constant electric field throughout the wire in order to drive a constant current (unless we are looking at superconductors, in which case the electrons will just be able to follow the circuit forever without an electric field, but we aren't).
Electrons will smash from atom to atom, losing all their velocity and need to be accelerated again in order to drive the current, and in order for this to happen, we need an electric field!
I mean, imagine for a second you didn't need an electric field. That means once you disconnected a battery and just put 2 ends of the wire together, you could just keep current flowing forever! (Again, perfect superconductors, but not usually)
Whats special about conductors, however, is not that there can't be an electric field inside, it's just that the electric field can't be DUE to charges INSIDE the wire.
In other words, it's not electrons inside the wire pushing other electrons inside the wire.
Think what would happen if this was true, even for a millisecond (which IS the case as soon as you connect a circuit). First, imagine we just have a piece of wire, and we want electricity to flow without it being connected to a battery. In order to have an electric field due to the electrons INSIDE the wire, there would need to be more electrons in one part of the wire than in another, since if they are evenly spread out there would be no net electric field. Sure, those electrons that are closer together would push the ones in front forwards, but they would also push each other in a bunch of random directions. And they'll keep on pushing each other in random directions until either there is no charge imbalance at all, or they can't push each other anymore, they've gotten as far apart from each other as possible, meaning they are now on the surface of the wire (more on this soon).
So, there can't be any imbalance inside a piece of wire. Now we connect both ends to each end of a battery and complete a circuit. What happens?
The battery obviously causes an electric field at both ends of it, making, for a millisecond, more electrons build up on the piece of wire connected to the negative terminal of the battery, and electrons flee the wire towards the positive side of the battery, creating a charge imbalance inside the conducting wire. However, the electrons don't like being shoved so close together, so they shoot off in random directions: some stay right there and let the others flee the scene, some forwards, some maybe even backward, and some to the surface of the wire. Let's consider each of them in detail:
The ones that got pushed backward (back towards the negative terminal of the battery) got pushed towards a place where there are even more electrons all shoved together. They really don't wanna be there, so they also get pushed in some random direction once more.
The ones that got pushed forwards, those create a charge imbalance in the area right in front of them towards where they got pushed, and they don't like that, so electrons in this new area get shot off in some random direction once again. However, note that the charge imbalance that got created in this area for the millisecond was less than the charge imbalance created where these electrons came from (closer to the negative terminal) because only some of the electrons got shot off in this direction.
There are also the ones that stayed right where they were, happy that it's not so crowded anymore
And the ones that went towards the edges: These get to the surface of the wire, and suddenly realize they have nowhere to go in the direction they were heading, not because there was a charge imbalance towards where they went, they were escaping a charge imbalance in the first place, but because they are literally at the surface of the wire, and if they keep on heading outwards, they will literally not be on the wire anymore. So they stay on the surface. Why?
They realize 3 things:
If any of them head back towards the center of the wire, they will create the charge imbalance once again, and thus will get pushed back. If this happens even for a millisecond, that electron that moved in will have created a local electric field, and thus will get pushed back out.
They feel like there is a charge imbalance up ahead, since some of the electrons got pushed off that way, but...
The negative terminal of the battery is right behind them, where the electric field originated (I know, positive is where electric fields originate, but I"m ignoring that for now), and the charge imbalance back there (electric force felt from back there) is stronger than the one they feel from up ahead.
So with nothing else to do, they stay on the edge and slowly make their way forwards, where the electron density is less than the one from behind.
Now, inside the wire, near the center, where the conglomeration of too many electrons originally was, there no longer is a charge imbalance, but these electrons that stayed there feel the same thing that the ring around them feels: they feel that the ring that formed right in front is less crowded the ring around where they are, so they also start heading forwards.
This continues all the way down the circuit to the positive side of the battery, each ring being a little less electron packed than the ring behind, until you get to the positive side, where there are almost no electrons on the edge, but also an equal amount of electrons and protons inside of the wire, with the electrons making their way forwards towards the part that seems like its even less crowded with electrons. If there wasn't an equal amount, these electrons would feel local electric fields and get shot off in random directions, and we already saw how that turned out, with electrons only on the surface of the wire.
This is why in a wire making up a circuit, it's not that there's no electric field, just that the electric field is only due to rings of charge on the surface of the wire itself. There actually is a constant electric field throughout the wire (the argument for constant is pretty much the same: if there wasn't, some electrons would get pushed faster than others and build places of higher electron density, local electric fields that would speed some electrons up and slow others down until once again the electric field was constant everywhere), while the electrons inside the wire are evenly spaced out with the protons, creating no local electric fields.
I think these 2 images show this pretty well: