I found an egg on the ground. How do I hatch it into a pet? It was dropped by a monster on the main world. Also, does the size or type of your pet mean anything?
Pets come in different rarity levels, Common, Uncommon, Rare, Legendary and Divine. Each pet can also have up to three abilities depending on their rarity level, and the abilities are improved by feeding pets items. - RoTMG Wiki
Pets are dropped by gods and can be hatched while in the Pet Yard by shift-clicking on the egg in your inventory. Once hatched, a pet has one ability but can be fused with another pet to unlock more. Pet abilities can include heal, magic heal, attacks of various ranges and powers (close, mid, and far), decoy, electric (paralyzes nearby enemies) and more. The healing powers are the most useful ones IMO, because the damage that pets do is barely noticeable.
Once hatched, there is no way to lose your pet. The egg will disappear from your inventory, and if you die with it it returns to the Pet Yard. "Feeding" your pet items will increase the level of its abilities for a cost of a little fame. The cost goes up as your pet becomes more powerful, so try to feed it only items with a high feed value.
You can "fuse" your pet with another of the same type, which increases its ability cap and sometimes changes its size/shape and unlocks new abilities. Never fuse your pet before its abilities have "maxed", or it will never be able to get to its full potential.
For (much) more information, either talk to the keeper in the Pet Yard or see the wiki's page on pets. (I haven't talked about the Pet Yard upgrades and probably missed other things.)