What is the origin of magnetism? for example , Why the secret of the origin of magnetism in iron is shell 3d while in the rare-earth metals 4f shell is origin of magnetism?
The origin of magnetism (that is ferromagnetism) lies in the exchange interaction of partly filled orbitals on neighboring atoms. The orbitals need to have some overlap, but not enough to encourage chemical bond formation. This is seems to be ha case for Fe 3d and lanthanide 4f's,
It will be easier to discuss these questions if you read first a book on Ferromagnetism-say by Chickazumi,Intro. to ferromagnetism.Most of the answers to your questions are discussed in the book. Good luck.