The scope needs to know where it is and where it is pointing. Some of the most recent ones may have GPS and gyroscopes to work automatically, but may not. Mine is about 5-6 years old. I have to enter the time and date on a keypad (I'm not sure if I had to put in the location the first time too), then I have two choices, Solar System Align or Three Star Align.
If you do solar system align, then you get a particular planet or the moon in the display and it tries it's best from there. It gets things pretty close. For the most accurate database hits and tracking you have to do the Three Star. With that one, you pick three bright stars, best if you pick them far apart. I usually go for one low, one high and one in the middle and try to make them 180 degrees apart (left to right). You don't have to know what the stars are, it just works that out from the database of bright stars. Once it has worked it out (you can query to see what you aligned to) you can then say "show me Mars" and it should pan round to show. I guess that internally it maps a triangle to the known night sky until it fits.
The more recent ones seem to be getting smarter. Some have wifi and can interface with your phone. That would make sense if they tied in alignment as you have accurate GPS and accurate time that it can pull from the phone. Not sure if anyone has made that leap yet though!