What makes magnets repel or be attracted to other materials?
First of all let me clear you what are called as magnets.
Magnets are those elements which are having electron pairs spinning in parallel spins.
They are known only to attract the ferromagnetic materials ( have electrons spinning in parallel spins and when a magnet comes near them the electrons arrange themselves in a crystal lattice)
and paramagnetic materials(when magnetic field is applied the electrons arrange themselves in a random aligned way)
Ferromagnetic materials are also refereed to as permanent magnets.
In short the materials which are attracted towards the magnet have electrons either aligned or formed as a crystal lattice when a magnet comes near them.