How can animations be applied to other models even they all have different joints and bones.

I know animations for octopus can not be applied to human.

but some animations for human models can be applied to other human models even they have different joints and bones.

how can it possible ?

I want to know fundamentals.
and Are there some rule for applying animations to other models? like they have to have same number of bones or have same names for each body parts.

Fundamentals - Mecanim humanoids | Unity Blog

“how can it possible ?”
https://unity3d.com/learn/tutorials/topics/animation

Are there some rule for applying animations to other models? like they have to have same number of bones or have same names for each body parts.
Yes - humanoid rig setup = retargetable to and from.

Links above will give you the fundamentals for retargeting in Unity. You will need to test the workflow out with multiple characters to get the hang of what is needed.