There's not a whole lot to it. Follow the existing cord into the housing. Remove the screws that hold the housing together and pull the housing apart. You'll see that your white wires are typically wire-nutted together and your black wire from the cord will probably have a 1/4 female spade connector and is connected to the switch. The other wire on the switch runs to the motor. All you need to do is buy a replacement cord(assuming you can't just cut the bad part off the old cord) and route it in the same manner that the manufacturer did and make the connections just as they did.
Have them serviced. These are notoriously hard to take apart and reassemble. Plus, the cords might be soldered or hard-wired to the switch or motor, making this type of repair very difficult and potentially dangerous.
I ran over my cord one time and had to take my vacuum cleaner to a repair shop to have a new cord put on. It was cheap. Maybe it was about 12 or 15 dollars.
Easier to just take them to a vacuum repair store and have them do it. They'll have all the parts and the knowledge to do it quickly. good luck