You can build a language from anything
Language is just a collection of building blocks. Human language is, of course, very complicated, but it must have been formed from the sorts of basic communication events that mammals the world over still use.
So 'math' is as good a way as any to communicate with someone else.
What will aliens and us mutually understand?
This is harder to grasp conceptually. If we just send the aliens some numbers, it may not be clear to them how to associate the symbols with any numerical meaning, without some sort of logical framework. How can you know that the symbol "2" represents the counting concept of two?
However, there should be some things that should be universally understood. A signal that oscillates between two values should be easily interpreted as binary. From there, we can send messages that are consistently framed that would be interpreted as integer numbers. By consistent framing, I mean that you would send your numbers in sets of 8 or 16 or 64 bits, just like computers do when they store integers.
Once you can send numbers, you can send patterns that will be obvious indications of intelligence: you could send a series of prime numbers or a Fibonacci sequence, the sides of all integral right triangles (i.e. 3-4-5, 5-12-13, 8-15-17, etc). Doing this should at the very least establish that you are talking with someone who can talk back.
Build from mathematics upwards
Obviously, we aren't the first ones to tackle this problem. There are already proposals for various way to build from mathematics into full fledged communication. Lincos is one, designed in the 60s, while a more recent one is Lone Signal. Lone Signal is designed around sending two things together: a very simple set of mathematical statements about he laws of physics coupled with messages in fully complex language. The idea is that the simple physical statements would act as a 'Rosetta stone' allowing the aliens to translate the full language.
There are doubts as to whether or not aliens would be able to translate human language at all. Noam Chomsky, using his theory of genetically determined grammar, suggests that without a built in faculty to understand human grammar, aliens might not be able to make sense of our language. In my opinion, while that would stop, say, Han Solo from talking to Chewbacca, it would not stop a computer from being able to decode an alien language.
How does the message work?
Technical details of the transmission setup are contained here.
Here is report on the test message. It was devised by Michael Busch from CalTech and broken by a colleague, Rachel Reddick from Stanford. Obviously, it would be easier for a someone with a human understanding of math and science to decipher a human-built code, but the recipient was able to quickly decipher the message with just pencil and paper.
In the test message link, the decoded message itself starts on page 9. The message starts with several tautologies to establish a vocabulary. I've tried to reproduce the decoded message and the quad side by side. The quad is simply two binary digits.
( ___0 = ___0 ) 00000000 10000000 01000001 10000000 00010000
( ___1 = ___1 ) 00000000 10000001 01000001 10000001 00010000
( ___2 = ___2 ) 00000000 10000002 01000001 10000002 00010000
( ___3 = ___3 ) 00000000 10000003 01000001 10000003 00010000
( _671 = _671 ) 00000000 10022133 01000001 10022133 00010000
( ___0 = -__0 ) 00000000 10000000 01000001 20000000 00010000
( ___1 ≠ -__1 ) 00000000 10000001 01000100 20000001 00010000
( ___1 ≠ ___0 ) 00000000 10000001 01000100 10000000 00010000
( _870 = _870 ) 00000000 10031212 01000001 10031212 00010000
( _870 ≠ _871 ) 00000000 10031212 01000100 10031213 00010000
From here, you see that we have established some symbolic 'language' already. What is encoded as parenthesis are frame divisions (00000000 and 00010000). Equality (a concept!) is expressed as 01000001 while inequality is 01000100.
From there, the message goes to describe the characteristics of our sun and of the elements, among other things. If the listener can identify the element, then they can associate the 'symbol' for the element. For example, oxygen is identified by 31020020; building off this water is identified by its chemical composition as 31021001.
Read the paper for more; there are 70+ pages of encoded and decoded message, along with an encryption key. Both concrete (water, electric charge, solar years) and abstract (equality, time) concepts are expressed within a mathematical framework with only a simple message.
Will it work?
Of course, this is the most important question, and one that we don't have the answer for.
But in summary, mathematics are important for two things: for establishing that we are communicating with an intelligent lifeform; and for building a simple 'Rosetta stone' of concepts that can be use to translate more complex language.