Each atom has its own magnetic dipole moment, i.e. each atom by itself is a magnet having its own north and south poles. In a non-magnetic material, atoms are randomly aligned and hence the magnetic dipole moment of each atom gets cancelled by that of some other atom. However in a bar magnet, majority of the atoms are aligned in a single direction giving rise to a net magnetic dipole moment of the entire bar magnet and hence making the bar magnet exhibits magnetism. However if a bar magnet is dropped or beaten repeatedly, the atoms lose their alignment and get aligned randomly thus leading to zero net dipole moment and hence the bar magnet loses its magnetism. You will be able to understand the concept more clearly when you study magnetism in Class XII.