During the examination period, the IPO checks the formal requirements (such as the name and address of the applicant, list of goods and services, etc.) and evaluates the trademark's distinctiveness and similarity to other trademarks in the same register. This process can take anywhere from 1 to 24 months, depending on the country.
It's important to note that this is not the final stage of the process. After examination, the trademark is published for oppositions where it can be challenged by owners of (potentially) similar trademarks. This usually prolongs the registration by another 1-3 months.
However, if the registration goes through, the trademark validity is backdated to the initial filing date, giving owners the right to challenge any mark that has been filed after theirs.
To learn more about the trademark registration process, read this article.