First, you will need to know the cause of the delay. You can do this by contacting your congressman. The USCIS congressional unit will respond to your congressman within one week.
If the response says that your case is on hold due to 212(a)(3)(b), then you you will have to wait until DHS grants a waiver or you can challenge the decision in the court of law to see why they have decided to put your case on hold. This will cost you money and you need a very good lawyer.
If your case is pending due to a pending background check, then you might need to talk to a lawyer who is experienced with Write of Mandamus cases.