The cogs on a bike cassette slide onto a set of splines on the freehub and are held in place by a lock-ring. The cogs usually come in a set, with some bolted together and some loose.
Take the wheel off the bike
Remove the wheel.
Access bike cassette
Undo the quick release skewer nut, slide the key into the lock-ring, replace the quick-release nut to hold the tool in place.
Grab a cog with a chain whip to resist anti-clockwise rotation.
With an adjustable spanner turn the key anti-clock wise to loosen the lock-ring.
Unscrew the quick-release nut and unscrew the lockring to free the bike cassette. Remove the lock-ring
Slide the bike cassette off the freehub.
If the bike cassette is to be re-used tie it up with string or a cable tie to keep all the cogs and spacers in the correct order.