You have to diagnose the fault then repair it...
You do not mention the make or model or if you have a fused plug and have checked the fuse and the socket you plug into etc...
The electricity travels along the cable - through a switch and to the motor often through an overheat thermostat. The supply to the motor is generally through carbon brushes but if these have failed you would likely have noticed unusual noises, sparks and smells before it stopped working.
The most probable cause for vacuum cleaner faults where the machine suddenly fails is one end of the cable (usually at the machine end) failing. Constant tugging eventually weakens the wires inside the insulation and they break. Pay attention first to the easiest things to check - particularly the integrity of the conductors inside the cable.
Peccavi, May 2009