Penalties for lighting up in the wrong place vary hugely by country. Some places treat it as a minor civil offence with a small on-the-spot fine, while others, particularly in parts of Asia and the Gulf, take it very seriously and fines can sting. A few countries also regulate vaping separately, and in some it is banned outright, so carrying a vape can itself be a problem even if you never use it.
Enforcement tends to be strictest exactly where tourists are: airports, train stations, metro platforms and popular attractions. These areas usually have cameras, patrols and clear signage, so the excuse of not knowing rarely works. Beaches and parks in some cities are also smoke-free now.
My practical advice is simple: look for designated smoking rooms or marked zones, and if you see no ashtrays and no one else smoking, assume it is prohibited. Check the official government or airport website of your destination before you fly, especially regarding vaping devices.