I love dudes on the internet talking about how they're "not allowed to compliment women in public".
How to compliment a stranger: Notice something s/he took special care on (hair if dyed or styled, shoes if unusual/cool, unique clothes) and say "hey, your ___ looks awesome" or "hey, I love your ___" where the ___ is hair/shoes/clothes. If you don't see something in particular but like how someone looks just say "I like your outfit!".
How not to compliment a stranger: "I like your ___" where ___ is a bodypart. Alternatively, expecting anything at all in exchange for your compliment/prolonging the conversation. Just move on.