It depends how long ago you had the operation. During the first weeks-to-months, patients are restricted to lying on the back. Many doctors request they use a special abduction pillow between the legs with another pillow under to knees to keep the hips slightly bent.
When the doctor gives you the go ahead you can sleep on the “good” side. This means the hip replacement is up facing the ceiling. You’ll still need a firm pillow that goes between the legs from the hips down to the ankles.
Lying on your stomach is not advised. If your doctor approves this position, you may need a pillow under the hips to keep them in a slightly flexed or bent position. It’s usually many months (if ever) that stomach sleeping is comfortable or safe.
Sleeping on the operated side is also delayed by many months if it is resumed at all. Most patients find this position too uncomfortable to rest well at night.