Magnetic force due to magnetic poles, from left to right: like poles repel (position of the hanging bar magnet is deflected accordingly), opposite poles attract, nail (soft ferromagnetic material) gets magnetised and always attracted to any pole of a magnet, the force on non-magnetic materials such as plastic and copper (without electric current) is typically negligible, electromagnetic coil with current can repel or attract the magnet (depending on the polarity of current), and the force on non-magnetic stainless steel (e.g. type 316) is negligibly small.
See also similar image with reversed poles:
bar_magnets_polarity_n_magnetica.jpg
You are permitted and indeed encouraged to use this image freely, for any legal purpose including commercial, and with any modifications (the permission is hereby given, so there is no need to ask for it explicitly again), but you MUST always give the following credits:
S. Zurek, Encyclopedia Magnetica, CC-BY-4.0
We would appreciate if you let us know of any use: info@e-magnetica.pl