Bid and Ask orders are limit orders (when investors place an order for an asset, you will need to input a price and quantity). Open orders are automatically matched and executed based on a matching algorithm for limit orders, which considers the limit price and the time the order was placed. Limit orders may be filled completely, partially, or not at all, dependent upon orders and quantities available.
Your order will only match if another investor places an order for the same asset, at the same price you placed or a better price. A buy limit order will only execute at the limit price or lower, and a sell limit order will only execute at the limit price or higher.
Time is considered when there are multiple orders for the same price. For example:
Investor A places a buy order for 10 shares, at $10 at 3:00 PM
Investor B places a buy order for 10 shares, at $10 at 3:05 PM
Investor C places a sell order for 10 shares, at $10 a 3:10 PM
A trade would be matched and executed between Investor A and Investor C and Investor B's order would still be open.
A single order may be matched in multiple trades. In the example above, if Investor C placed a sell order for 20 shares at $10, there would be two trades:
Trade #1: Investor A, Investor C for 10 shares at $10
Trade #2: Investor B, Investor C for 10 shares at $10