A bond needs to offer a specific yield or rate of return in order to attract investors. Interest rate changes will have an effect on the price of a bond. If interest rates rise, the value of a bond will go down and its price will drop, and vice versa.
The reason for this is that if current interest rates are higher than the coupon payments of a bond, investors will need an incentive to invest into an instrument that pays lower interest than alternative investments. As coupon payments are fixed, the bond will have to sell at a discount.
If, on the other hand, coupon payments are higher than prevailing interest rates, investors would be willing to pay a premium on the face value of the bond. Therefore the yield on a bond needs to be at least equal to current prevailing interest rates.
In general, the price of a bond is the sum of the present values of all cash flows during the life of the bond, including all coupon payments and the payment of the face value at maturity. These known future cash flows are discounted to their present value to determine the bond’s price:
\(Bond \:price=\frac{C}{1\:+\:i}\:+\:\frac{C}{1\:+\:i^2}\:+\:…\:+\:\frac{C}{1\:+\:i^n}\:+\:\frac{M}{1\:+\:i^n}\)
Where:
 \(\mathrm{C}={\mathrm{ coupon\: payment}}\)
 \(\mathrm{M}= {\mathrm{value\: at\: maturity, \:or \:par\: value}}\)
 \(\mathrm{n}= {\mathrm{total\: number\: of\: payments}}\)
 \(\mathrm{i}= {\mathrm{interest\: rate,\: or\: required\: yield\: for\: the\: appropriate \:period}}\)
This formula can be simplified for basic bond structures, which pay a series of fixed payments at set intervals over a fixed period of time:
\( Bond \: Price = C \: \times \: \frac{ 1 \: – \: \frac{1}{1 \: + \: i^n}}{i} \: + \: \frac{M }{1 \: + \: i^n}\)
This formula has as an underlying assumption that the first coupon will occur in one interval. For example, if a bond pays in sixmonth intervals, the first payment will be made six months from now.
As an example, in order to calculate the price of a simple plain vanilla bond, with a face value of €1,000, a maturity of 8 years, a coupon payment of 8% and a required yield of 9%, we need to determine:

The number of coupon payments.
As the bond will pay the coupon twice a year and the first coupon payment is six months away, the bond will pay 16 coupons.

The value of each coupon payment.
As the bond pays a coupon twice a year, the annual coupon rate of 8% must be divided by 2. The resulting 4% of €1,000 gives us €40 per coupon payment.

The required yield per coupon payment.
Again we have to divide the required yield per annum by the number of coupon payments in a year (2), which results in 4.5%.
\( Bond \: Price = 40\: \times \: \frac{ 1 \: – \: \frac{1}{1 \: + \: 0.045^{16}}}{0.045} \: + \: \frac{1,000 }{1 \: + \: 0.045^{16}} \: = \: € 943.83\)
As expected, with a required yield that is higher than the coupon payment, the value of the bond is lower than the face value and should sell at discount.