You usually have a windvane or an autopilot. Depending on the design of the boat, windvanes can be quite effective on a wide range of points of sail. There are other techniques that allow a boat to be self steering without a windvane or autopilot but most of these a very sensitive to changes in wind speed.
When single-handing you only sleep for short ''catnaps'' of 10 to 15 minutes each. For some that works well almost indefinitely but for others exhaustion comes very quicly because their physiology and inherent sleep pattern requirements.