Number of k-long identical values in a N-long string made by choosing between two characters Let us imagine a string made of $N$ characters, each of which can either be $1$ or $0$.
Let us define in addition a state as a sequence of $1$'s and $0$'s, $N$ characters long.
There are in total $2^{N}$ states.
I would like to compute how many sequences of $1$'s long $K$ exactly characters (i.e. consecutive $1$'s) there are, in all the states. By "exactly" long $K$ characters I intend a string of $K$ $1$'s, preceded and ended by a $0$ (unless the string commences in the location $N=0$ or ends in $N=N$, i.e. the ends of the string) . So, for example, the string 01110 qualifies uniquely as a string with three characters ($K=3$, not two 2-characters-long 11 sequences. 
To clarify further, sequences are being counted, not states: for example, the string 0110011 contains two sequences. I would like to count all such sequences, for any lenght $K$ present in all the $2^{L}$ states.
As I am not versed at all in combinatorics, I started out by a "brute force" approach.
Considering a string long $1$, so 010 or 10 (if at the beginning), I thought, well this can be placed in N places. For each place one could work out the number of combinations allowed in the remainder of the string (which have of course to exclude 1-long strings). This approach leads great compications to me. 
Thanks a lot for your inputs.
Thanks a lot
 A: Let $f(n,k)$ denote the total number of $k$-runs of $1$'s in all of the $n$-states, with $1\le k\le n$. Observe that for any $n$-state, and any particular $k$-run in that state, you can insert an additional $1$ to get an $(n+1)$-state with a $(k+1)$-run, and furthermore this operation is reversible.  So $f(n+1,k+1)=f(n,k)$, and hence $f(n,k)=f(n-k+1,1)$.  In other words, it suffices to consider the case $k=1$; $f(n,1)$ is the number of isolated $1$'s ranging over all $n$-states.
It's not hard to see that $f(n,k)$ can also be interpreted as the total number of $k$'s ranging over all compositions of $n$.  (You get a composition from a state by listing the run-lengths; this mapping is two-to-one as a state and its complement give the same run-length sequence.  For sequences starting with $1$ you want the $k$'s in even positions, and for sequences starting with $0$ you want the $k$'s in odd positions.  So you end up just counting the $k$'s over all compositions of $n$.)
Thus $f(n,1)$ is the total number of $1$'s ranging over all compositions of $n$.  This sequence $(1, 2, 5, 12, 28, 64, \ldots)$ appears as sequence A045623 in OEIS where you can find recurrences, generating functions, etc.
