You get a registered trademark by applying with an intellectual property office, a government body presiding over the intellectual property of a given jurisdiction.
You can either fill out an application yourself (depending on the jurisdiction) or have someone with legal experience (lawyer/attorney/online service) do it for you, as the mark and the application have to meet certain requirements to be accepted.
After submitting your application, the IP office will evaluate your mark. This process usually takes from a couple to several months, depending on the country. The process also includes an "opposition window", a stage during which other trademark owners can come forward and challenge your application if they believe it infringes on their trademark.
If there are no unresolved issues, your trademark will be accepted, and you will get a trademark certificate. The validity of your trademark will start counting from the filing date and will generally last for ten years, after which you can request trademark renewal.
You can read more about the process in our Trademark Academy.