There are some great resources on lucid dreaming, some people really seemed to have mastered it. It's a lot about training ourselves to remember our dreams and find patterns in them, as well as creating the habit of doing "reality checks" during the day, hoping that we'll also do them while we sleep and then realize that we're dreaming.
My man has tried that a few years ago and he needed two weeks of doing those practices to turn lucid in his dream.
I've had a few dreams like that accidentally when I was a child, but never again since, although I'm quite a vivid dreamer and almost always remember them.
Anyway, interesting topic. We spend so much time dreaming, and it's truly a mystery sometimes :)