A bond represents a debt obligation whereby the owner (the lender) receives compensation in the form of interest payments. These interest payments, known as coupons, are typically paid every six months. During this period the ownership of the bonds can be freely transferred between investors. A problem then arises over the issue of the ownership of interest payments. Only the owner of record can receive the coupon payment, but the investor who sold the bond must be compensated for the period of time for which he or she owned the bond. In other words, the previous owner must be paid the interest that accrued before the sale.
The interest paid on a bond is compensation for the money lent to the borrower, or issuer, this borrowed money is referred to as the principal. The principal amount is paid back to the bondholder at maturity. Similar with the case of the coupon, or interest payment, whoever is the rightful owner of the bond at the time of maturity will receive the principal amount. If the bond is sold before maturity in the market the seller will receive the bond's market value.
For example, suppose investor A purchases a bond in the primary market with a face value of $1,000 and a coupon of 5% paid semi-annually. After 90 days, investor A decides to sell the bond to investor B. The amount investor B has to pay is the current price of the bond plus accrued interest, which is simply the regular payment adjusted for the time investor A held the bond. In this case, the bond would be $50 over the entire year ($1,000 x 5%), and investor A held the bond for 90 days which is almost a quarter of the year, or 24.66% to be exact (calculated by 90/365). So, the accrued interest ends up being $12.33 ($50 x 24.66%). So investor B will have to pay investor A the value of the bond in the market, plus $12.33 of accrued interest.