Choose an origin and signed coordinates. The centre of mass is \(x_{\mathrm{cm}}=\sum m_ix_i/\sum m_i\) in one dimension. Apply the same average to each axis in two dimensions.
For a uniform straight rod the centre of mass is its midpoint. Holes or extra masses change the distribution. The centre of mass can be in empty space, as for a uniform thin ring.
For fixed masses, \(\mathbf v_{\mathrm{cm}}=\sum m_i\mathbf v_i/M\) and \(\mathbf p_{\mathrm{total}}=M\mathbf v_{\mathrm{cm}}\). Opposite momenta subtract as vectors.