Close order tactics go back to the Greek phalanx. You form your men into a line, shoulder to shoulder, have them march in step to keep the line straight, and have at it. At Marathon a much smaller force of Athenian heavy infantry defeated utterly a far larger Persian army. Close order tactics were the only tactics known from that day down to modern times. The replacement of spears an pikes by muskets didn't change tactics much. You still formed your men into line, in the open, and had at it. The colorful uniforms and tall hats of the period were designed to make your formed line of troops look bigger, taller, and more dangerous to the enemy. Close order tactics persisted down to World War I. Officers liked them because it kept the men together, in sight, and within earshot of shouted commands. At the battle of the Somme in 1915, the British infantry "went over the top" in line and marched thru no mans land toward the German trenches. The Germans machine gunned the assaulting British with gusto.
Open order tactics go back to the battle of Kings Mountain in the American Revolution. A superior force of loyalist militia, commanded by the famous Major Patrick Ferguson was wiped out in South Carolina by a patriot militia composed of Scots Irish back woodsmen. Major Ferguson positioned his men on high ground, in line, ready for an infantry attack which never came. The patriot backwoods men moved up under cover, in small groups and when close enough, fired into the massed loyalists. The loyalists replied with volleys of musketry and sometimes massed bayonet charges. Some two thirds of the loyalists were shot down against patriot casualties of only a few dozens. At the end, Major Ferguson attempted to break out of the encirclement on horseback. The patriots fired a volley and blew the major out of his saddle. Later they counted seven bullet wounds in Ferguson's body.
Open order tactics didn't catch on in a big way until the very end of World War I. Dubbed "Ludendorf's infiltration tactics" they contributed to the success of the last German drive on the Western Front in 1918. Open order was adopted generally after that. In modern form, a dozen men, a squad, with a light machine gun, led by an NCO, is the lowest level of organization. On attack, the squad moves up until resistance is encountered. At which point, the machine gun is emplaced in a likely location, and under cover of its fire, the riflemen move up until they reach another likely location for the machine gun. The riflemen then give covering fire while the machine gun is moved up closer to the enemy. This process is repeated until the objective is taken.