Clear all the furniture out of the room, leaving nothing on the carpet.
Remove the baseboard or floor molding with a pry bar and set it aside.
Pull up the carpet starting in a corner using needle-nose pliers. Do not roll the carpet up, just free the edges of the one side from the tack strips. Then, free two other sides from the tack stripping, leaving one side caught on the tack strip.
Stretch the carpet taut using a knee kicker, making it tight and removing any slack. Once tight across the floor, stretch it over the tack strips around the three sides.
Tuck the carpet between the tack strips and the wall with a carpet tucker, then cut off excess with a utility knife to finish the carpet repair.
Refasten the molding or baseboards around the room with a hammer and finishing nails. You can then move the furniture back into the room.