Ketogenesis occurs whenever glucose (i.e., carbohydrate intake) drops low enough to require it. I just watched a lecture by Dr. Nadir Ali, in which he states that glycogen stores get emptied out after about four hours of sufficiently low carbohydrate intake. This triggers the α-cells of the pancreas to secrete glucagon, and thus stimulate the liver to produce ketones and the small amount of glucose the body actually needs.
The key is the ratio of insulin (which is secreted by the β-cells of the pancreas) to glucagon. A low ratio means that glucagon predominates, which puts the body in a ketogenic state. A high ratio means that the body is taking in, metabolising, and storing glucose (it gets transformed into fatty acids in the liver, for storage in our fat tissue).
So glucagon stimulates ketogenesis, and insulin inhibits it. This is why it is helpful to eat fewer times a day, since every meal stimulates insulin to some extent (fat has the least effect on insulin secretion, but it does stimulate the secretion of enough insulin to keep us alive). A well-formulated ketogenic diet does mimic fasting, in the sense that it puts the body in a ketotic state, though the range of nutritional ketosis is generally lower than the range of fasting ketosis.