Well it's easy, so you can reverse the process if the fit isn't right.
You'll need a correct sized Allen key - probably 5mm though it might be other. The topcap (on top of stem and steerer tube is likely to be 6mm). Have a set handy.
Loosen off the 2 bolts at the back of the stem (don't need to remove them, just slacken until you can swivel the stem and bars side to side a bit).
Loosen and remove bolt and topcap (this provides preload tension on the headset bearings (top and bottom of headtube).
Undo and remove bolts and faceplate of stem (2 or 4 bolts) and set to one side, allowing handlebars to swing free.
Pull stem off fork steerer, along with any spacers etc above it, and invert stem. Replace spacers.
Now re-assemble following reversed instructions. Grease threads of all bolts, it'll save you a lot of creaking sounds down the track.
put bars in place, carefully tighten stem bolts onto faceplate (correct way up?) and if its a 4 bolt face then tighten gradually going around the 4 bolts in the following pattern.
1 3
4 2
Don't go too tight, try to tighten all bolts evenly, and make sure the bars are centred and angled correctly for you.
Then finger tighten the stem bolts at the steerer end (only just) and then reinstall topcap and preload bolt. Tighten gently until the headset bearings swing smoothly and there is no 'play' (ie rocking or looseness) in the fork or bearings. When happy with this adjustment, snug down the stem bolts to clamp the stem onto the fork steerer. (it's common to get this wrong once or twice and to repeat the steps to achieve desired preload).
Check again that all bolts are installed correctly and check snugness. Resist the temptation to snug down bolts 'just to make sure'.