Obtain a permit for your shed electrification project at your jurisdiction’s zoning office. Ask how deep the trench for the electric wire needs to be to comply to your area's building code; 18 inches is a typical depth. Also ask about an inspection schedule as well as all requirements on the electric wire gauge and conduit size.
Dig a trench that is the depth dictated by your area's building code. Either dig the trench by hand with a shovel or use a walk-behind or ride-on trencher, which can be rented. Make the trench in a straight line from the panel where electricity enters your house to a spot on the exterior of your shed where you want the electric supply wire to emerge.
Cut a length of UF-B 12/3 electric wiring rated for underground use. Make it long enough to run from the house electric panel, down to the trench, along the trench to the shed and back up to an outdoor-rated switch box that will be 1 foot off the ground on the shed.
Lay 1-inch conduit connected with liquid-tight connectors alongside the trench. Draw the UF-B 12/3 electric wiring through the conduit with fish tape.
Attach the outdoor-rated switch box to the shed's exterior, placing the box 1 foot off the ground. Wire the outdoor-rated switch box with the UF-B 12/3 electric wiring so that the black and white wires go to the marked terminal switches or push-in opening for the stripped wires. Wrap the ground wire around the ground screw, and tighten the screw. Install a ground fault circuit interrupter (GCFI) receptacle in the shed and an overhead light socket if desired.
Hire a licensed electrician to connect the other end of the electric wiring to a new circuit on your home's electric circuit breaker panel -- unless you are qualified and experienced in that task, and have the electrician complete or inspect the wiring of the shed receptacle and, if applicable, the overhead light socket.
Schedule a zoning inspection of the job before back-filling the trench with soil.