There are lots of different Hagia Sophia tickets and many combine a visit with other Istanbul attractions. For simple Hagia Sophia tickets that include a bit of history, opt for the one-hour English guided tour.
For even more in-depth information, get the ticket with skip-the-line entrance, which includes a highlights tour and an audio guide.
If you're looking to visit other sites and get some value for money, opt for the Istanbul Pass. The Hagia Sophia is also included in the Istanbul Welcome Card and the 5-day Guided Museum Pass.