Megaesophagus predisposition:
The basic info is that ME does seem to be confirmed to be genetic in some breeds, but not in all. My suspicion is it is genetic in all breeds, unless caused by some external factor, but enough work has not yet been done to show this.

The two most common modes of inheritance are dominant and recessive. Of the breeds known to have genetic ME, some seem to be dominant, and some recessive, meaning different genes have to causing the problems in these breeds. From what I have seen, the majority of the known breeds seem to be recessive, which does not surprise me, because recessive traits can skip generations and are thus harder to weed out.

Every individual of a sexually reproducing species on this planet has two genes for any simple trait (complex traits often involve multiple types of genes). One copy of the gene comes from one of the two copies the mother has, and the other copy of the gene comes from one of the two copies the father has.
Which of the two copies of each you get is entirely random chance.

Any type of gene may have multiple variants, some of which may be bad, such as a gene for ME.

For a recessive gene, if an individual has only one copy of the bad gene, then they will not show the problem but can still pass it on to future generations. Only if the individual has two copies of the bad gene, one from each parent, will the individual display the problem.

The result of this is that if an individual shows a recessive condition, then both the parents have the gene also. When it comes to breeding dogs, that means that if a puppy shows ME in a breed where ME is known to be recessive, then neither parent should be bred again, as they both have the gene and can pass it on.

Also, none of their puppies should be bred, either. By the laws of probability, roughly half of the puppies will have one of the gene, not show the problem, but be able to pass it on. About a fourth will have two of the gene and have the problem. About a fourth will have none of the gene and hence cannot pass it on. These could be safely bred, except that without a genetic test, there is no way to know which these are. Hence, until a genetic test is available, none of the pups should be bred.

Note that these probabilities only refer to all pups from many such litters. In any particular such litter, any result is possible. It is less likely, but all of the pups in any one litter could have one of the gene and not show the problem and be able to pass it on, or all of them could have two of the gene and have ME, or all of them could be free of the gene.

Also, the grandparents of any dog with recessive ME should not be bred either, because at least one of each pair of grandparents has to have the gene, in order for both parents of the ME dog to have one of the gene.

For recessive genes, it is easy for it to skip generations, since a dog can be carrier without having the problem, but still be able to pass it on to future generations.

For a dominant trait, as opposed to a recessive trait, only one copy of a bad gene has to be present for the individual to exhibit the trait. This also means that only one parent has to have the gene for an offspring to have the problem.

The good thing about a dominant trait is that it is usually easier to spot, because it will not skip generations.

If you breed a dog with a dominant gene for some disorder with a dog with none of the gene, then statistically about half of the pups will have the gene and the disorder, and about half the pups will not. This is subject to the same caveat as earlier, that this only applies to large numbers of such litters, and anything can happen in any single litter.

Typically, if you are trying to distinguish a dominant trait from a recessive one, if a pup exhibits the trait but neither of the parents do, then it is probably a recessive gene.

The exception might be if it is a trait that takes a while to manifest itself and the parents have just not had the time to show it yet. However, if it is a problem that typically shows up in puppies, then this exception is probably not applicable.

Below is a link to the possible genetics of ME in various dog breeds:
http://www.caninemegaesophagus.org/Genetic_Predisposition.html