From what I understand, it's a matter of training your brain to recognize when it's dreaming and be able to apply the part of your brain that's responsible for critical thinking (which is typically 'switched off' when you're asleep).
I recently became interested in trying to have lucid dreams and did a little bit of reading. It seems the best thing you can do is force yourself to remember and record your dreams the moment you wake up (waiting even more than a few minutes makes recalling your dream extremely difficult). This helps train your brain to recognize when it is dreaming. It also helps to read some of your dream journal before going to bed to remind your brain what a dream is like.
A couple weeks ago, I had my first lucid dream in years, and the only thing I did to achieve that was recording my dreams and doing my best to remember them (happened within a couple weeks of starting my dream journal). Remembering your dreams is the most important thing because, even if you do have a lucid dream, it's pointless if you don't remember it.
(Well, I lied a bit about me keeping a dream journal. I didn't actually write anything down, I just recalled my dreams, put them into words, and did my best to remember that. It worked better than expected. I dreamed every night for a week or two, and had one lucid dream. Within a week of that lucid dream I had, I got a bit lax about forcing myself to remember my dreams and stopped remembering my dreams altogether. Bit of a shame, really. Alright, New Year's resolution time- I'm going to record my dreams when I wake up every morning.)