The shell theorem states that a uniform hollow shell has no gravitational effect on its interior. It does not state that mass inside of the shell has no gravitational effect.
Fig. 1 below shows a sphere of some mass. If you place a test mass on its surface it will attracted towards the center of the sphere by a certain magnitude of gravity.
If you fit a hollow shell around this sphere as in Fig 2, The extra mass, as per the shell theorem has no gravitational effect on it interior, but it doesn't cancel out the gravitational effect that it already there. That same test mass, sitting where the inner sphere and outer shell meet, still feels the same force of gravity pulling it towards the center of the sphere as it did before it was enclosed with the shell.
Assuming that the density of the shell is the same as the sphere, if we put the test mass on the outer surface of the shell, it is twice as far from the center, but the combined mass of the shell and sphere is 8 times that of the sphere alone. The net result is that the test mass will feel twice the gravitational force that is did sitting on the surface of the inner sphere.
If you keep adding shells, (or divide a sphere up into shells) as in Fig. 3, you get the same effect. Put a test mass anywhere in it, and while it feels no gravitational effect form the mass of the shells exterior to it, it does feel a gravitational effect from the mass of all the shell interior to it.
Fig. 4 show a representation of a galaxy inside its dark matter halo. If you were just to consider the galaxy and worked out the gravitational effect as you move out from the center, you would expect things to work out pretty much the same as above with gravity increasing as you moved outward from the center*. However, once you get out into the disk, the interior mass at any point now longer increases by the cube of the distance, and the increasing distance begins to dominate causing a fall-off of gravity as you continue to move outward. In terms of orbital velocities, you would see an increase at you moved outward while in the bulge, and then a decrease as you moved outward once in the disk region.
When you add the dark matter halo (as shown in Fig. 4) you also have to take into account the additional mass of the shells of dark matter interior to your position. Even once you move outward into the disk of the galaxy, the volume including this mass increases by the cube of the distance. Now the density of the dark matter halo is quite low compared to that of the galaxy itself, so while you are in the bulge, this additional mass doesn't have much of an effect. But once you get into the disk, the mass of the dark matter in the interior shells adds up much faster than the added mass of stars in the disk as you move out, and it exerts a greater and greater relative influence. This influence is to flatten out the decrease in orbital speed as you move out from the center to the point where it is close to non-existent, and the velocities hardly decrease at all (or in some cases actually increase).
Now the dark matter halo extents well past the galaxy itself, and those shells further out than the edge of the disk have no effect on the galaxy. So how do we know its there? Galaxies are rarely solitary for one thing. Our own galaxy has satellite dwarf galaxies orbiting it. So we can look at these and their velocities to get an idea of how the dark matter is distributed outside of the galaxy. In addition, gravity bends the path of light, so by looking at how light is lens as it passes through the regions exterior to the visible part of the galaxy we can map the dark matter halo.
* Here we are assuming a fairly constant density or at least a density that increases smoothly as you approach the center of the galaxy. This isn't exactly true, because we have very high density object in the form of a super-massive black hole at the center. Once you start getting close to it, it will begin to dominate and gravity force goes up. We actually see something of the same effect for the Earth. The crust is much less dense than the interior, and as a result, as you move from the surface towards the interior, for the first few miles or so the force of gravity will increase before it starts to decrease again.