I may extend this later to consider irregular time signatures but for the moment I'll only cover the usual suspects.
To start, count the beats: usually two to four. Often this is made clear by beaming. At other times, you could tell by the choice of rest. For example, two quarter-note rests, and an eight-note rest followed by a dotted quarter-note rest, both add to the same value. However, the first might belong to a 3/4 measure and the second to a 6/8 measure. Ties will often give you some hint, for example a quarter note followed by two tied eighth-notes followed by another quarter note is likely a giveaway for compound time as it is going across the beat. It should be clear from the notation whether your beats are half-notes, quarter-notes, eight-notes, or others.
If you have a simple time, you will be writing 2, 3, or 4 as the top number. If you have a compound time, you will be writing 6, 9, or 12. The bottom number will be 2 for a half-note beat, 4 for a quarter-note beat, and so on. It will be 4 for a dotted half-note beat, 8 for a dotted quarter-note beat, and so on.
A time signature matching a given measure can always be given, but it may not prove to match the rest of the music. Even when it does, it may not match the time signature actually present.
Is this 3/4 or 6/8?
Without more information we can't be sure. This extract is from Chopin Op 53. The beaming suggests 6/8, but this work is in 3/4. The music has been written this way to clarify phrasing.
Is this 3/2 or 6/4?
This is from J. S. Bach BWV 663. Both answers are correct, there is no way to tell which he wrote.