Sugar/salt frosted around the top of a cup/mug
Place the sugar (or salt) in a bowl or plate large enough to hold the glass (upside down)

Rub the rim of the glass with lemon (or lime, or use simple syrup) the rim should be wet and sticky.

Roll/Dip the rim of the glass in the bowl full of sugar.

In my experience, you need to leave the glass to dry for a few minutes to let the sugar or salt settle and dry properly; or long enough to prepare your drinks (or tea).

There are numerous video on the internets showing this.