In order to get an egg you must put two Pokémon
of the same egg group in The Daycare at the same time. Ditto can make an egg with
any Pokémon when using this method. However,
most legendary Pokémon (along with a few other non-legendary) cannot make eggs whatsoever.
Once you have the two Pokémon in The Daycare, just walk around a little while. Come back to The Daycare and soon enough the Daycare Man will be standing in a different spot than before. Talk to him. He will give you an egg.
The egg is
always the same species (or the bottom of that species's evolutionary line) as the female Pokémon that was put in The Daycare. If one of the Pokémon was a Ditto, the
egg will bear the species (or bottom of that species's evolutionary line) of the non-Ditto Pokémon, because
Ditto eggs do not exist. You may also notice there are Pokémon besides Ditto that are non-legendary, which have no gender (Magnemite, Staryu, etcetera).
They can only breed with Ditto.
For example:
Ditto
+Rhydon (any gender)
=Rhyhorn egg
Ditto
+Staryu (which has no gender)
=Staryu egg
Male Raticate
+female Dugtrio=Diglett egg
Male Beedrill
+female Yanma
=Yanma egg
Male Dratini
+female Kingdra
=Horsea egg
Egg groups are categories of compatible Pokémon (in other words, Pokémon that can create eggs together). For what Pokémon are in what egg group, go
here. Normally, however, your best judgment will do. If you think two Pokémon will be able to mate, then try it out.
Hope this helps.