There are three simple steps on your way to get a MyPet.
Find a mob that is leadable is the easiest step. All leadable mobtypes can be found here.
This can be the hardest part but how hard it really will depends on the configuration of the Server.
This article only covers the default configuration that can be also found here (Leashflag).
There are 6 different requirements that can be applied to the mobtype. Every LeashFlag can be combined with each other but some of them will only apply on some mobtypes.
When Step 1 & 2 are done you just have to hit you target with the LeashItem (String by default). After hiting your target it will convert from a normal mob into a MyPet and you will see a message like this: You took a pet on a lead, it will be a good MyPet.
Congratulation you took a MyPet on a lead.