There are two very useful methods.
First, as a general extention of the first reply, assume certain typical oxidation states for the usual suspects. This can backfire sometimes, so realize there are some notable exceptions. The most electronegative atom in the compound will typically assume its lowest possible oxidation state. The least electronegative atom will assume its highest oxidation state. The reamining atoms are obtained by difference knowing that the sum of the oxidation states is the charge.
For instance, H2SO4:
O is the most electronegative, so it gets -2 (it's lowest possible oxidation state). H is least electronegative, so it gets +1 (it's highest possible oxidation state). The overall charge is zero, so by difference, the S is +6.
2 (+1) + 4 (-2) + S = 0 therefore S = +6
There is a second, easier method. As usual, I will preface this by saying I am taking this from the Berkeley Review materials and I believe it is their copywrite protected method, because I have never seen it in another textbook. That said:
Look at every bond an atom makes. For every bond to a more electronegative atom, give it a +1. For every bond to a less electronegative atom, give it a -1. For every bond to the same atom, give it 0. Add these numbers, along with the charge, and you get the atom's oxidation state.
For instance, consider ethanal (H3CCHO):
Carbon one has three bonds to H (-1 for each) and one bond to carbon (zero). It has no charge, so it has an oxidation state of -3.
Carbon two has one bond to hydrogen (at -1), two bonds to oxygen (+1 for each), and one bond to carbon (zero). It too has no charge, so it has an oxidation state of +1.
The second method works the best, although if you only have a formula, and don't know the exact structure, you can't use this method.