I do a lot of long-haul flying. I have a 13.5 hour trip tomorrow.
I will not be sleeping on the flight. Some crew do. For certain operations, adequate sleep facilities must be provided. There is neither a requirement that the pilot sleep, nor is it always possible.
Moving between time zones, and flying both sides of the clock means that frequently I'm just not going to be sleeping. It's not uncommon to take off east bound and turn a long night into a very short one, with nearly two days of daylight, or fly the other direction and never leave night, or to gain a day or lose a day.
There are tips and tricks in hotels, using light or backout curtains, sleeping when able, avoiding caffeine, etc...but the bottom line is that I find that I may not sleep when rest is available, because I can't. On long trips, I don't like to sleep, and usually don't.
Some pilots operate under regulations that allow a 30 hour duty day, and I've seen a lot of those. Long days.
When home, I get tired in the middle of the day, sometimes, and often stay up all night.
For crews going to a rest area, it's a matter of juggling crew to ensure no one exceeds their legal time in the pilot seat, and going to a dark area to lay quietly with a little music, or a set of earplugs and a comfortable temperature...it's a matter of doing what one must. If one has regular trips scheduled, then one can learn to sleep.
I knew a captain many years ago who would fall asleep right after takeoff. I mean literally right after takeoff. Once, departing Honolulu, before the landing gear was up. I kid not.