How can I learn to sprint and ride out of the saddle?
If you want to improve balance and control out of the saddle at any speed, even freewheeling, you just have to practice doing it.  Note that balance while pedaling out of the saddle on a trainer vs. on the road will be very different as the bike is held firmly upright in the trainer

With respect to power output: pedaling out of the saddle is usually done for a short burst of power against a high resistance with a low cadence - either up a short steep slope or accelerating in a too high gear. Pedaling at a sitting cadence while standing up will be quite inefficient.

Basically, you have to get the gear ratio selection right to enable max power output. Lower for in the saddle, higher for out of the saddle.

Edit:

You might want to experiment with how forward or back over the bottom bracket you position yourself when out of the saddle. You may find you can find a more comfortable position that works better for you.