The first thing you'll want to do to prepare your engine for storage is make sure the engine oil is clean. Old oil can trap contaminants which damage rubber seals, and performing an oil and filter change before long term storage will help preserve your engine.
If you won't be riding your motorcycle for several weeks (if it's carbureted) or several months (if it's fuel injected), you'll want to make sure your fuel delivery systems are ready for inactivity. With a carbureted engine, you should turn the petcock into the "off" position, loosen the float-bowl drain screw, and catch the fuel in a container. If draining it isn't possible, you can run the engine with the petcock in the "off" position until it dies. Because moisture can accumulate in half-empty tanks, fill up with gas and top it off with a manufacturer-recommended fuel stabilizer or Sta-Bil. Some believe draining the float plugs isn't necessary if stabilizer is added to the fuel and properly run through the fuel system; do whichever process you feel most comfortable with.
If you're storing your bike for more than six months, you might want to protect your piston and cylinder rings from potentially rusting. To do so, remove each spark plug and pour a tablespoon of fresh engine oil or spray fogging oil inside. Ground the ignition leads and turn the engine several times to spread the oil before replacing the spark plugs.
Spray some WD40 into the exhaust pipe(s) in order to keep water away; the "WD" stands for water displacement, and keeping moisture out will prevent rust. You can also keep water and critters out by stuffing intake and exhaust with crumpled plastic bags.
Clean battery leads and attach a battery tender to your battery to keep it charged and ready to go when you're ready to bring the bike out of storage; if you don't have a tender, a trickle charger is better than nothing.