You can train yourself to do it, and to have the possibility that you might be dreaming in your mind - randomly throughout the day, think to yourself "if I'm dreaming, this cup will turn pink" or whatever. Eventually, you'll do this when you are dreaming, and the cup will turn pink

so from there you can steer your dreams in more interesting directions.
Sometimes if you realise you're dreaming, you reflexively wake up, so adding some mental framework can protect you from that.
Some music can trigger (or ease) lucid dreaming, such as brain entrainment.