Uranus and Neptune came later. William Herschel discovered Uranus in 1781 with a 15 cm telescope, Neptune was first observed by J. Galle in 1846 after Le Verrier and J. Adams both predicted the position of the eighth planet. These ice giant worlds have been visited only once by Voyager 2, and much of what we know about these distant worlds has been revealed by Hubble and ground based observations over the past two decades.
One of the driving goals behind the exploration of the giant planets is he quest to understand the formation of our solar system. We know that planets orbit in the same plane (almost), on nearly circular orbits, and that they rotate anticlockwise just like the Sun. This suggests that they all formed from a disk of material, an idea supported by the observations of protoplanetary disks around young nearby stars. Furthermore, there are two types of planets in our solar system: the high density terrestrial planets (3-5 g/cm3) with very few satellites, and the low density giants (0.7-1.7 g/cm3) with extensive satellite systems.
This hierarchy of planets is due to the conditions in the nebula as the planets formed. Embryos of solid particles were embedded in the hydrogen-rich disk, and as more refractory elements (I.e., metals and silicates) were found in the high temperature inner solar system, versus the more icy materials at the cold outer reaches, this explains why the inner and outer solar system look so different from one another. The available solid mass was lower in the hot inner solar system, whereas abundant ices in the outer solar system produced big embryos of ten earth masses or more. Once a critical mass for these embryos was reached, the extensive gassy atmospheres of the giants was accreted directly from the gas-rich nebula.
This core accretion scenario was developed by Mizuno (1980) and Pollack et al. (1996). More recently, the idea of planetary migration has been added, known as the "Nice model" (A. Morbidelli et al.), where the 2:1 resonance crossing of the Jupiter-Saturn system led to intense perturbations of other bodies in the system and generated the Late Heavy Bombardment, whose impact scars dominate the appearance of rocky bodies in our solar system to this day. In an earlier phase, Jupiter may have approached the orbit of Mars (stopping its growth) and then receded due to Saturn's interaction (Walsh e al. 2011).
The giant planets can be further subdivided into the gas giants (Jupiter (5 AU) & Saturn (10 AU); 318 and 95 Earth masses, respectively) comprised mostly of hydrogen and helium, and the ice giants enriched in heavier materials (potentially delivered as ices, hence their name). Uranus and Neptune are smaller (14 and 17 earth masses), and their different atmosphere composition is usually attributed to their formation timescales - they formed after Jupiter and Saturn at a time when there was less gas available in the disk (it was being dissipated). The migration hypothesis suggests that the ice giants formed closer in (10-15 AU) and migrated outward to their present positions (19 and 30 AU).
The bulk atmospheric compositions support the idea that the planets formed in a disc with temperatures decreasing with distance from the young sun. At low temperatures, thermochemical equilibrium implies that the key elements (C, H, O, N) were in hydrogenated, reduced forms of methane, water and ammonia - the key ices thought to have formed the giant planets and still present in their atmospheres. At the higher temperatures of the inner solar system, those species exist as CO, CO2 and N2, precisely the species found in the terrestrial atmospheres (although these came from later out gassing of secondary atmospheres, rather than accretion of primary atmospheres like the giants).
Remote sensing of giant planet atmospheres, in addition to the Galileo probe, have provided supporting evidence of the core accretion hypothesis of planetary formation. Both the carbon and deuterium abundances increase from Jupiter to Neptune, as expected if the ratio of gassy envelope to planetary core decreases with distance from the Sun. The Galileo in situ entry probe discovered that almost all of the elements making up Jupiter were enriched over solar composition, supporting the existence of planetary embryos enriched in abundance compared to the rest of the gassy nebula. This direct measurement is something scientists are keen to repeat on the other giant planets in our solar system, particularly an ice giant, to understand the differences in how these bodies formed. Remote sensing cannot measure the abundances of the noble gases, which are key indicators of the way in which materials like ice and gas were accreted into the giants.
One big mystery about Jupiter's composition remains unanswered - the abundance of oxygen. If all the other materials were encased in cages of water ice, then there should be lots of it. Unfortunately Galileo was unable to measure the deep water abundance to confirm this. The Juno probe, due to arrive in 2016, carried with it a microwave instrument capable of peering beneath the Jovian clouds to sample the deep water abundance. Scientists wait with baited breath for the answer to this crucial question of how Jupiter formed, with far reaching implications for the evolution of our whole planetary system.