Endurance is a (special/hidden) gene that determines if a horse has enough lasting speed to run races longer than the route distances. Horses with average endurance are usually skilled enough to run marathon races. Some, but not all, marathon horses will also be able to transition to steeplechase.
Marathon races are very similar to regular flat races. The primary difference is that marathon races are 14 to 16 furlongs and only for horses who are 4 years old or older. Marathon horses all have a distance range of 12-16 furlongs, and can still enter standard 12 furlong races and be competitive there.
Unlike all of the standard distances, no horses are born with a preference for marathons. It is something a horse can be retrained for anytime after they turn 4. In order to be eligible to be retrained, a horse must be a least Good for Route genes and also must have an excellent or better Endurance (hidden gene) ability. To know if a horse is (or will become) eligible, you can go to their Manage page and see if there is a green checkmark next to Marathon.
If your horse is eligible and you'd like to retrain them for Marathon, all you have to do is click that button. It is a permanent change, but can be useful to do if you have multiple horses in a certain distance category. In addition to making the horse eligible for a new group of races, it will also give them a new favorite distance within their new range, add 5-10 races to their longevity, and add one year (12 prime) to their prime. Because of the longevity/prime bonus, transition to marathon races can be great for older horses that are low on longevity or declining in peak but can still be decent point or money earners.
Marathon races are held at the standard tracks (on both dirt and turf) and use your standard jockeys. There are marathon divisions within the World Championship Festival, which are the second highest paying divisions after the Classics. Points earned in marathon races will also count towards stud eligibility and performance merits.