You are asking 2 different questions, or rather you have 2 different tags on your question - repository and mirrors.
Most of the answers have already addressed the why and how behind mirrors. As one more anecdote (and the plural of anecdote is data!) I run a mirror of Mint, Ubuntu, and Debian simply to provide much quicker access in the computer lab I teach in. 20 folks all getting updates at once, or doing netinstalls, or ... goes much quicker at gigabit speed vs. the 5mb internet that feeds the building.
The ideas behind the repos for Ubuntu actually all start with Debian (which Ubuntu is heavily based on) and Debian's package management system which includes the
apt utilities in various versions and incarnations (
aptitude, etc). With the Debian package management system, a standard base system is told where to get software packages and updates from. This could be any number of sources - hard drives, cd-rom/dvd, network share, or via network protocol like http(s), ftp, and rsync. Part of this information includes what software is available, and what packages depend on what other packages all the way down to the base system.
This allows you to run a command like
apt-get install task-mate-desktop and the package management system says "well, you need to have this version of libraryA installed, and that version of libraryB installed and foo version 3.14 and ... " and since it knows what you have installed, it knows what it needs to retrieve from the source (quite probably one of those mirrors you were asking about), and it goes gets what it needs and installs it all. Note that the GUI software management tools in Ubuntu et al. are all just front ends to apt and dpkg.
Now, the Debian/Ubuntu/Mint/etc. folks aren't the only ones doing stuff like this. The BSD releases and the ports collection as well as the
yum for Redhat and similar distributions, the portage collection from Gentoo, and others.