It would make sense that a magnet would operate like a battery and would run out of power. Actually, it turns out that magnets don't operate like batteries. A magnet works by the atoms lining up in a piece of iron or steel. When the atoms are aligned, north and south poles are created, resulting in magnetism.
Similarly, how does a magnet loses its magnetism?
Yes, it is possible for a permanent magnet to lose its magnetism. There are three common ways for this to occur: 1) Via heat: ferromagnet materials will lose their magnetism if heated above a point known as the Curie temperature. Modern materials do not suffer this type of problem.
How long does it take a magnet to lose its magnetism?
This alignment is damaged over time, principally as the result of heat and stray electromagnetic fields, and this weakens the level of magnetism. The process is very slow, however: a modern samarium-cobalt magnet takes around 700 years to lose half its strength.