I think Star Walk is up there in terms of top apps - most people I know have it installed on their phones and iPads. It's a sensational application.
iPhone knows your latitude and longitude --- your position on the surface of the Earth. It also knows the location of each star. Lastly, it knows which way your screen is pointing.
That's all the knowledge that's needed in order to display a starfield on the screen.