One of the major highlights of Istanbul, the Topkapi Palace was built between 1459 and 1465 by the Ottomans just after their final conquest of Constantinople. This palace was the seat of power of the Ottoman Empire for 400 years. The palace is laid out around four courtyards, the first courtyard being outside the main gate.
The palace is located just to the northeast of the Haghia Sophia, and commands wonderful views of the Bosphorus Strait from the innermost (Fourth) courtyard.

A view of the Fourth Courtyard. The Baghdad Pavilion (center-right) was built in 1639 to commemorate the capture of Baghdad by the Sultan Murat IV. The small golden dome to the left is where the sultan would break his fast after the month of Ramadan.
Allow at least 3 hours to visit the palace, which offers (in addition to a number of palace rooms) several museums displaying the amassed wealth of the sultans over the centuries, including a treasury with stunning precious jewels, another containing weapons, and separate museums with manuscripts and a very interesting collection of clocks. No pictures are allowed in the museums.

Our friends in the Third Courtyard at the palace, the Library of Ahmet III (built in 1719) is behind them.
Numerous items which belonged to the Prophet Mohammed are found in the Pavilion of the Holy Mantle, which makes the Topkapi Palace one of the most sacred pilgrimage sites of the Islamic faith.
The Harem rooms provide some insight into life in the palace. The Harem contained about 1,000 women (essentially slaves) brought from all over the Ottoman Empire. Their dream was to become a favorite of the sultan and to bare him a son which might lead to marriage and higher status. The Harem was ruled by the sultan’s mother, who was the most powerful woman at the palace.

Dormitory of the Harem Eunichs. Dates from the 16th century. The eunichs worked in service of the Harem. The more senior eunichs lived in the lower floor. They were recruited from all over the Ottoman Empire to serve in the palace. They supervised the quarters of the female population, and became more influential in state affairs in the 17th and 18th century.

The Apartment of the Queen Mother, the most powerful woman in the Harem, and an extremely powerful member of the Ottoman Empire. She influenced political life in the empire, and regulated the relations between the sultan, his wives and children.

Summer Pavilion (Circumcision Room)
Room built in 1640, circumcision ceremonies of the crown princes were held here. Some of the most beautiful tile work in the palace is in this room.

The Hall with a Fountain.
This beautiful vestibule is where the princes and consorts of the Sultan would wait before entering the Imperial Hall.
A visit to the palace requires two separate fees and tickets, unless you get the Museum Pass in Istanbul which is good for 72 hours and allows entry to multiple sites and immediate access to the sites without waiting in line. The cost of the pass is about $36 USD. There is a kiosk right outside the Haghia Sophia. The Topkapi Palace gets very crowded with tour groups, so I highly suggest arriving before the palace opens. We were the first ones into the Harem and had the rooms to ourselves.
References: Plaques throughout the Topkapi Palace and DK Eyewitness Travel Turkey.