Whether I sleep well or not has to do with a few variables.
One, I have to feel clean, so if I feel dirty then I typically shower before bed. If I don't then I won't sleep well. The bed being made before hand is also a big one that I didn't realize effected me until recently. Climbing into a nicely made bed every night feels amazing. If the sheets are untucked or my pillows are all over the place, then I find it much harder to sleep.
Two, if I've just eaten something high in sodium, like fast food, then I know I'll be awake for a while, so I try to keep the eats to a minimum at least 2 hours from sleep time.
Three, I sleep much easier if I go to bed before my set time that I typically go to bed. The longer I stay up past bed time, the more anxious I am about how painful the next day is gonna feel when I inevitably have to wake up and don't feel well refreshed.
Something else I've been doing lately is watching a streamer play a couple games I used to play religiously back in the day (haven't been back in years, but I enjoy watching this particular streamer). It's very soothing and normally puts me to sleep in 15 minutes if I don't fight to keep watching. Without him, having recently eaten, sleeping in a junky bed, and already being up past my bed time, I can sit there for hours tossing and turning as my mind races thinking about the most irrelevant things. It's literal hell.
A couple years ago I moved for work and now have a roommate I share a kitchen and bathroom with. The person I'm living with is really disgusting and loud, so it can be hard to stay consistent with things like sleep as I have to wear earbuds every single night or I simply cannot sleep because I can hear other rooms around me as well.
A couple years prior, however, I had one of the most consistently good sleeps of my life and this went on for years. I don't remember my late night routine much, but I remember waking up at least two hours before work to get ready, which was really unnecessary but I enjoyed that job so much that I would go out of my way to wake up earlier and get to work an hour before we opened.
I really liked that job, but I also really looked forward to the commute from my home to work. It was just long enough to not be annoying and I had a car at the time that I absolutely loved to drive to and from work, so there was this excitement every morning that I'd be able to enjoy that car and then get to work with people I loved doing a job I was good at. The streets were so empty that early in the morning, so I'd tear ass.