To add to John Rennie's answer and Hennes's Answer, an answer to your last sentence:
How will the aliens know what this means?
is well given in a thoroughly interesting and enjoyable tale by Carl Sagan's novel Contact. I can't recall whether the following is made clear in the film with Jodie Foster.
In the novel, signals received from the Vega system is an out-of-Earth culture's equivalent of the Voyager's golden record. In particular, Sagan describes in great detail how this culture has highly thoughtfully arranged things so that humans will recognise the signal as that from an intelligent civilisation, and moreover be able to decode it with no knowledge of that culture. The concepts of integer and prime number, which are universal and independent of culture, was used to achieve this:
The signal's global structure was a repeating sequence of 26 otherwise unrelated large prime numbers. The universality of integers and primes allows a human reader ken that this is something very special, and the otherwise random relationship between the primes makes it unlikely this is anything other than a purposeful message;
Further analysis of the signals fine structure shows that it comprises a huge number of basic units, perhaps letters. Moreover, this huge number is the product of three primes. So it is not much of a stretch to conclude that the message is a rank three array. Presumably, the alien culture perceives three spatial dimensions as we do, so there are two simple candidates for what a rank 3 array of symbols might be conveying: (1) a sequence of two dimensional still pictures, or (2) a three dimensional still. In the first instance of the message, the message was a retransmission of Adolf Hitler's opening speech of the 1936 olympics, thus letting us know that the other culture had intercepted our transmissions into space and had understood them to some degree. In the second instance of the message, the message was a three dimensional blueprint for a machine that would transport humans to Vega and thus allow contact.