Let M be a compact surface, either orientable or non-orientable. We study the lower central and derived series of the braid and pure braid groups of M in order to determine the values of n for which B_n(M) and P_n(M) are residually nilpotent or residually soluble. First, we solve this problem for the case where M is the 2-torus. We then give a general description of these series for an arbitrary semi-direct product that allows us to calculate explicitly the lower central series of P_2(K), where K is the Klein bottle, and to give an estimate for the derived series of P_n(K). Finally, if M is a non-orientable compact surface without boundary, we determine the values of n for which B_n(M) is residually nilpotent or residually soluble in the cases that were not already known in the literature.