TPS interview question

How the locators are created? How do you handle flaky tests?