If your broker goes bust, your broker may owe you money if your account was in profit. This means that you are a creditor and your claim will rank alongside other creditor's claims. Your rank will depend on the insolvency laws in the country where your broker is incorporated.
Some countries have implemented regulations to protect depositors. In the UK, the FSA requires that brokers segregated investor funds. In addition, the Financial Services Compensation Scheme will protect you up to £50,000.
Other countries have different rules. For example, Cyprus has its own rules and protection fund for traders.
It's a good idea to check which country your broker is incorporated in before opening an account. Make sure you're familiar with financial protection laws and regulations if you plan to deposit a large amount of money with your broker.