I know I have to get 8 hours of sleep and study my spell book for an hour to study and use spells. If I only study a certain number of spells and kept a few unstudied, can I prepare one later on when the need arises? How long will this preparation take?
Yes you can; it will take 15 minutes, longer if preparing more than a quarter of your total slots. According to the PHB, under Spell Selection and Preparation: