Alliances are groups of Empires that came together to stay safe, attack the Computer Players, wage war, and many more reasons. Alliances can consist of many or few members, sometimes even one member. The amount of members in an alliance is restricted by the level of the leader's (or alliance former's) embassy multiplied by two.
2 x (Embassy level of leader)=Maximum number of members.
If you wish to join an alliance (not make one) you must ask the alliance leader if you can join (via Email or in-game chat) and await the invitation. Then when you get the invitation, go to your embassy and accept the invitation. Now you are in an alliance.
An alliance has many benefits. First, an alliance shares probe data, so you can see the planets your alliance mates see.
Second, there is a stash (available through the embassy) that allows you to switch out your materials for free. You have one (1) exchange per level of embassy every 24 hours.
Third, your spies cannot be caught on your allies planet. (although why would you be there anyway?)
Forth and lastly, being in an alliance allows you to build a Space Station (or more than one) which is one of the hardest things to have in the game. Everyone in your alliance can control the space station (through voting, which is why big alliance could be somewhat inefficient) but only the owner (ownership can be transffered) can build on the space station. A better description and prerequisites are outlined in the space station page of the wiki.
And that is pretty much what an alliance is!