When hitting a shot from a lie that is sloping sideways, the ball will likely not go straight.  This happens because the sole of the club is placed level with the ground (to avoid the heel or toe of the club catching the ground), which rotates the loft of the club to include a sideways orientation.  When the ball is struck and topspin imparted to the ball, the axis of spin is tilted, so the aerodynamic force generated due to spin is also tilted, causing the ball to curve.  With the ball spinning on a tilted axis, the low pressure is no longer directly on top of the ball, but has been rotated around toward one side, so the ball curves in that direction.  The direction that the ball will curve is away from the hill.

Sidehill Lies 
Which way will it go?

To compensate for the altered flight, the aim can be adjusted toward the side that is uphill, and the ball can curve back to the intended direction.  Be aware that the ball will also not fly as high because the full aerodynamic force is not oriented upward, so distance will be affected.

Adjusting how the club is gripped on a sidehill lie can alter the orientation of the clubface so it is still aligned in the intended direction.  A useful learning exercise is to tape a tee to a golf club and rotate the club about the ground (lowering and raising the shaft) and about the shaft (twisting the shaft) and paying attention to what direction the tee points.  The tee is an indicator of the perpendicular direction from the face in which the ball will start its flight.

Notice that when the shaft is rotated down closer to the ground (without twisting it), raising the toe, that the loft direction points more inward.  This would be like having the ball on a slope above the feet.  Then open the clubface by rotating the shaft until the perpendicular direction is restored to the original direction.  The clubface is now oriented straight ahead again, but clearly with much more loft.  This demonstrates how the clubface angle changes and indicates that a club with lower loft should be used in order to produce the intended distance with an open clubface.

Similarly, on a slope with the ball below the feet, the club can be closed to offset the outward change in face orientation due to the shaft being raised.  While the direction will be restored, the result will be a lower loft angle, so a higher lofted club may be chosen instead when closing the face.

A secondary lesson is that if the club is not grounded flat on a level lie, the same tilting of spin will occur causing the ball to curve from the intended direction.  This is often checked by applying masking tape to the sole of the club and then seeing whether the tape toward the heel or toe wears away after a few shots.  Proper club fitting will avoid undesirable curvature of the ball's flight due to tilted spin.

sole level
shaft down, toe up
then twist shaft, open face
aaaaaaaaaaaaiii