This is not how to determine a magnet after it's created, but rather before it is created. How is the polarity of a magnet created (why does one side go this way and the other go the opposite)? Is it randomly decided based on forces acting on the soon-to-be magnet, or is it aligned with the Earth’s magnetic fields?
The alignment is basically random, but it can be tipped in favor of one direction or another based on the ambient magnetic field of the Earth. In fact, when molten ferromagnetic material upwells from deep within the Earth, at, say, the Mid-Atlantic Ridge (see this wiki article), it will align with the current magnetic field to the extent that we can measure a net magnetization in the solidified rock. In fact, we can trace the history of the Earth's magnetic field in this way, and it shows that there have been numerous reversals of North and South over the ages.
When you run a DC current through a coiled wire, it will create a magnetic field, with a polarity determined by the direction of the current. The polarity can be determined by the right-hand rule. Note that it uses the direction of "conventional" current i.e. current going from the positive to the negative terminal of the battery. The "real" current, being made up of negatively charged electrons, flows in the opposite direction.
Ferromagnetic materials such as steel and ferrite can be permanently magnetised by putting them inside the coil. They get the same polarity as the field generated by the coil.