The sun's upper atmosphere (the corona) is very hot and some of its hydrogen and helium are able escape the sun's gravity. Because the gas is hot and is in constant solar illumintation it becomes a fully ionized plasma. This streaming plasma is the solar wind, and it flows out past the earth affecting the earth's magnetic field, the magnetosphere and ionosphere.
A fairly sharp boundary exists between the solar wind outside and the magnetosphere inside which is called the magnetopause. This is roughly spherical on the sunward side and cylindrical on the anti-sun side.
The interplaneteray magnetic field or IMF is the magnetic field of the sun, "frozen" into the solar wind and swept out along with it. Some of the earth's magnetic field lines near the poles are able to "connect" with the IMF and are swept along with the flow for a long distance in the anti-sunward direction and form the geomagnetic tail or magnetotail.
Here they may "reconnect" again with the earth's field. The plasma trapped in the reconnection region is accelerated towards the earth becoming heated, and forms the plasma sheet. Some of the particles in the hot plasma sheet travel down the magnetic field lines and precipitate into the atmosphere in a ring around the pole called the auroral oval.
The resulting magnetic field of the earth is highly distorted from the simple dipole field it would have if it were not for the solar wind.