$1^T \cdot A \cdot 1$ is the sum of all the entries in the matrix $A$. These entries are, in position $ij$, 1 if there is an edge from vertex $i$ to vertex $j$, and 0 otherwise. (Or, in a multigraph, the number of edges from vertex $i$ to vertex $j$.) Since your graph is undirected, each edge shows up twice: once in position $ij$ and once in position $ji$ (except for any loops, which just show up in position $ii$.)
So, adding all these up gives you twice the number of edges in the graph, at least if there are no loops.
(With loops, it is still true, if you adopt an appropriate convention, e.g. put a 1 in entry $ii$ and count loops as half an edge, or else put a 2 in entry $ii$ (because the loop is incident to vertex $i$ twice.))