Good question - this is frequently overlooked or ignored by demonstrators that start with the four aces on top!
Starting with the two you mention, there are a few ways to locate cards for stacking...
- Your own hole cards from the previous hand; noting at which position they end up in the discards
- Community card from previous hand, if they are dealt
- Hole card of any partners you have in the game; you may need a method of communicating their value (though not always)
- Any cards you can surreptitiously peek when collecting up or shuffling the deck
- Cards can be modified to enable them to be located and controlled during the shuffle - such as strippers
- Any cards that have been held out in previous rounds
- Marked cards can also be read and stacked
This is not an exhaustive list, just the ones that come to mind.