I "walked the walls" on my own and that takes you through some pretty rough neighbourhoods and in retrospect was probably not the best idea. At the time, though, it did not feel unsafe. In general I suppose taking the ordinary precautions that a single traveller should take will (probably) keep you safe, i.e. keeping to well-populated areas and not accepting invitations to go with someone you don't know to somewhere unknown.
As for what you should see, you will get the greater value from the historic mosques and palaces if you read up a little in advance. This city has a truly fascinating past, long and diverse, and populated by a cast of unique and colourful characters, inspirational, mad and evil beyond comprehension in turn. The Topkapi Palace and the Hagia Sophia mosque are the main tourist sites, together with several of the grander mosques, all of which are organised for tourist visits. Of the smaller (not that much smaller) mosques, I would suggest the Sokullu Mehmed Pasha or the Rustem Pasha mosques, the first for the instructional design and the second for its eye-popping traditional decoration. The Saqarin is a more modern and quite stunning example of the genre. (Most mosques are named after an historical figure, or the patron who paid for them. Even a little research here will pay off in terms of added interest.) I would suggest that you spread out your mosque visiting so you don't, like me, get the details confused in your memory.
If you visit most of these and add the covered markets and the Bosphorus cruise (I went up to the Black Sea and back, half a day, but even the ferry crossing to the Asian shore for lunch would be worthwhile), you can see that three or four days can be taken up. Add in a visit to the ancient cisterns under the city and perhaps the Dolmabahce palace for variety and you won't in five days have time for even one out-of-town excursion.
The city has hotels in abundance in the full range of prices. The traditional wooden hotels are quite scarce but worth looking out for if you are happy with a less luxurious feel (not always cheap though and often in dark sidestreets.). Other forms of entertainment like belly dancing during dinner (oddly enjoyable) and Mameluke music together with experiencing the whirling dervishes as @Unicorn suggested are easily accessible to the interested visitor. Taxis are reasonably cheap and public transport useful though crowded. Beware of the suburban train services unless they have now decided to have doors on them!
I could go on but as you see I am an enthusiast.