How do I check the polarity on a loudspeaker?
I have an 8 ohm 2 inch speaker with no wires soldered into it and the terminals have no markings.
How do I know which of the two terminals is positive and which is negative?
The reason for keeping the polarity of speakers the same in an audio system is so that you don't end up with a phase difference between channels if different channels are connected reversed. If you have a single speaker the signal is AC so it doesn't really matter which way around it is connected. Assuming you do have multiple speakers so the polarity matters:
Often the negative is a smaller pin but regardless if the speakers are identical the polarity won't matter as long as all are connected consistently.
Otherwise you can check the polarity by attaching a battery but especially for a small speaker like that (probably only 0.25W) I'd recommend a 1.5 V battery and even then don't it leave it connected for very long because speakers don't like DC applied for long. Probably even safer for a speaker that small would be to put a 100 ohm or so resistor in series which should still give you enough deflection to see.
As already mentioned the convention for polarity is that a positive voltage on the positive speaker pin will cause the cone to move outwards.
Take a 9V battery and touch the terminals to the speaker terminals. The speaker cone should move out and then in. If it does, then the polarity is correct. If the movement is inward first, swap the wires around on the battery and look again. The movement should be outward first, showing you have the proper polarity.
Speakers don't have a required polarity. Either way will work. Where it matters is if you have more than one speaker: then you want them all hooked up With the same polarity. If the speakers are identical, just hook them up the same way. If they aren't the same, use a battery as @Eddie suggested, though I agree with @FakeMoutache to start with a 1.5 volt battery.
BTW, the reason for this is to avoid the speakers producing out-of-phase sounds.