In technical terms, an AS number is a 16-bit integer assigned by InterNIC and used by BGP to implement policy routing and avoid top-level routing loops. A more enlightening view is of an Autonomous System as a collection of CIDR IP address prefixes under common technical management. For example, the CIDR block from 18.104.22.168 to 22.214.171.124, as well as network 126.96.36.199 might be AS 2934. Let's say a host in another network tried to connect to 188.8.131.52. Most likely a series a default routes would deliver the traffic to an ISP router with a defaultless routing table. This router, and others in the Internet backbone, would then route the traffic according to its rules for AS 2934. Once the traffic reaches AS 2934, an interior routing protocol (such as OSPF) would be used to deliver the packets to their final destination.
If you draw a network map of AS's, three distinct types can be identified:
Interior routing policies and protocols must be established within each AS, enabling it to route packets internally. A Stub AS can usually have a default route to its parent. A Transit AS must use default-less routers. A Multihomed AS may use either default-less routing, or setup a default route to one of its neighbor AS's, but this will probably result in poor quality routing. Exterior routing, with a routing protocol such as BGP, is used to interconnect the various AS's, with their independant interior routing protocols, into a single coherent Internet.