There are both state court and federal bankruptcy liquidations.
Presuming that either the company voluntarily files or is placed involuntarily into a federal bankruptcy, then the following describes the process.
First, creditors with liens on assets of the company get the lesser of the collateral value or their claim amount.
Then if there is cash after that, it goes to pay the costs of administering the bankruptcy. Then what is left over after that goes to the priority creditors (e.g. employees with unpaid wages
earned within 90 days of the bankruptcy, customer deposits, taxes, etc.). If there are funds after that, they are divided pro rata among all other creditors (I'll call them the "general unsecured creditors"). If they are paid in full, then the money is then divided among the equity
Since I don't know what form your investment took, then I can't say where you fall in this cascade. If you have liens, you would get first money out. If you invested as a creditor, you would be in the general unsecured creditor class. If you were an investor (which your question implied), you are at the back of the line.
The process will likely take 1-2 years in my experience.
Yes, the trustee
and his attorneys' fees come out ahead of the creditor claims (other tan secured claims).
Let me know if I missed any part of your question!