Perfect competition is a theoretical market structure that is typically not found in reality. It serves as an important concept as there are many markets out there that are very close to perfect competition or still exhibit many of the behaviours of a perfectly competitive market structure. There are a number of properties that characterize perfect competition. There are an infinite number of buyers and sellers. This implies that each buyer or seller has an infinitesimally small market share and therefore his or her individual choices do not affect the market at all. There is perfect information. Each buyer and seller knows all the information about prices, suppliers, consumers, preferences, quantities, etc about the market. So, no inefficiencies can stem from asymmetries in information. The product sold is homogenous; iut does not matter who you buy the good from. Lastly, there are no barriers to entry and exit. Firms can enter and exit freely and without cost (cost would be a barrier).
In this market structure the price of a product is determined by the market supply and the market demand. The demand for an individual firm will be a perfectly elastic demand curve at the level of this market price. This will also represent the average and marginal revenue of the firm. In the short run firms can earn positive or negative profits. Positive profits can occur whenever the price is higher than the average costs of production for the firm. But, in the long run firms earn zero profits because of entry and exit.
Consider a market such as the rice market, which is considered quite close to perfect competition, where the price is above average cost and farmers are making a positive profit. Other farmers, seeing this, will enter the market to take advantage fo these positive profits. As they do so, the market supply will increase which will force the market price to fall. The market price continues to fall until there is no more positive profit. At this point entry will also stop and the market will have achieved long run equilibrium.
Perfectly competitive markets are capabale of achieving allocative and productive efficiency.