Do not expect this to go fast or to be easy. Some breeds, such as the more intelligent ones like Border Collies, train much faster than others, like Shih Tzus. Your pup may not be physically ready to learn when you first get him, but you must start training him right away. You can expect to see results after the pup has reached 12 weeks, as this is more often the time they gain, and understand how to control, their body functions.
Because house training requires attention and time it is best to plan on getting a pup when you have the time to devote to training it. If you work an 8 hour day, or have young children who need your attention, you will not find this easy to do.

Image Source
Crate Training, Why?
Crate training has proven to be the MOST SUCCESSFUL method of house training pups, and even adult dogs. The pup will usually resent the crate at first but eventually he will come to know it as his safe place. The crate training method will save you a lot of grief because the pup will be contained and not out destroying your home. Having a dog that accepts being in a crate will make it a lot easier for you if you have to kennel him or take him on trips. Some areas have laws that pets cannot be loose in your vehicle. Dogs who are not used to being kenneled will become scared and stressed if they have to be kenneled at a groomer or veterinarian office.
The whole idea behind crate training is that a dog does not want to mess in its' bed. So by confining it to a small space you force it to hold its bladder and bowels until it can be out.
Selecting the Crate
The pup must be able to stand up and turn around in the crate, however you do not want a crate that is too large. If your crate is too big the pup can still mess in the crate and sleep in another area. Line the crate with a blanket.
Some breeds of dogs are small enough that you only need one crate for the life of the dog. Others grow so fast you may find they outgrow their crate in a short matter of time. You might find that you can buy a good crate at a second hand store, sometimes even animal shelters will offer used crates for sale. There is no harm in trying to save some money by buying used, just make sure the kennel is secure, the doors and locks work, and that you wash it thoroughly with bleach.
Getting Started
The first few nights will be the worst. Put the crate near the back door, rather than in your bedroom. This makes it easier to get the pup out quicker, plus you won't hear the whining so it will be easier to ignore. You may find it handy to put a radio next to the crate and have music on softly to sooth the pup.
In the morning you must be ready to go. Get the pup out of the crate and quickly outside. You MUST go out with the pup too. Have in your pocket a "soft treat reward" ready to offer as soon as the dog urinates. A soft treat reward can be hot dogs, cheese, or soft dog treats. It is important these rewards be chopped very small. Too much will make your dog fat and you will be using a lot of rewards for training.
Dogs will usually urinate within minutes of getting outside first thing in the morning, you must offer the reward and praise the pup right away. Then it is back inside to eat. After breakfast you and the pup must go back outside again. Usually within 20 minutes of eating they will have a bowel movement. Running will stimulate the bowels. Again you must be ready with the soft treat reward, and a lot of praise. Try to pick up the dogs mess right away so you discourage the bad habit some pups learn, of eating their own stool. Now you should be fine to go in for a while. Crate the dog if you must go to work or be away, but other wise allow it to remain loose in the home. You might find a baby gate to be handy to keeping the pup in a certain area of the house. Do not take your eyes off of it. As soon as it starts to circle and sniff the ground this is your cue to go back outside again.
The better quality food your pup is on will determine how often it has a bowel movement. Better food = less poop. In fact some dogs on high quality food will only go poop once in the morning.