"Two birds are flying in the sky."
If the birds are flying in the sky, shouldn't it be で instead of を?
Not in this case. そらをとぶ is a fixed expression meaning 'to fly the sky' or simply 'to fly'.
In English this direct translation might not sound natural. We, however, have the expressions 'sail the sea', 'swim the channel', 'fly the friendly skies', etc. While we can also say 'swim in the channel' and 'fly high in the sky' the intention of the phrase is different.
It might be better to imagine this as 'fly across the sky' instead. On the other hand, attaching a defined counterpart word in English is not necessarily the best way to learn Japanese.
Because I learned in another lecture o means across or through, de would mean in.
Anyhow I guess you are right
Looks fine to me, albeit being different in construction from what most textbooks will teach.
If I had to guess I'd say that since「空を飛ぶ」 is a fixed expression, 空を must be as close as possible to 飛ぶ ... But I am not a native speaker.
There's no rule that fixed expressions must remain unbroken. A word or clause can be inserted without affecting the meaning of that expression. As を works to link the preceding noun to the following verb there is no problem with comprehension.「空を長時間飛ぶ」「空を鳥が飛ぶ」are but a couple examples that exist in reference materials.
Japanese often uses 'counters' to indicate the number of something. Flat objects use まい, long and thing objects use 本, and in this case birds (along with rabbits) use わ.
1 bird 一羽（いちわ）のとり
2 birds 二羽（にわ）のとり
There are many counters and resources can be found to memorize them. Suggest you start here for some background.
二わ の 鳥 , is the の necessary here? I thought it was allowed to leave it out, but Duo doesn't accept this answer. Now I'm confused...
It is necessary. In particular, countable nouns are normally separated from other nouns by the particle の when the counter precedes what is being counted. You can think of it as similar to the function of 'of' in English.
When the counter follows what is being counted, the の can often be dropped. 二羽の鳥 = 鳥二羽. That being said, 鳥の二羽 would also be fine grammatically, but as there is little possibility for confusion, the の would normally be dropped.
Finally, にわとり (鶏) means chicken. 二羽鳥 would seem to read as 'two-feathered/two-winged bird'. The separation created by の helps to clarify the fact that these two nouns are separate.
Why has the counter changed? Up to this point I've only seen the ひき counter used for birds (in Duo, anyway)
My answer was: 「鳥は空を二羽飛んでいます」 (tried with and without kanji), and I'm still not clear what was wrong with it.
空を飛ぶ is a set expression, meaning to fly (the sky).
を normally occurs directly before the verb, to mark the direct object (Throw→the ball / Fly→the sky). If there is another word between を and the verb, it would usually be marked with another particle, such as で to mark the words function (Throw→the ball→with one's right hand / Fly→the sky→on two wings).
二羽 can mean either two (birds, rabbits, etc.) or it can mean 'two wings', depending on context and grammar. Your 二羽 combines with the verb 飛ぶ to make the composite noun-phrase 'two-wing flying' (二羽飛び）. As it is now a noun-phrase, the conjugated form would incorporated into a sentence as 二羽飛びをする, where (again) を marks the object (To do two-winged flying). On the other hand, you could insert で, and have 二羽で空を飛ぶ or 空を二羽で飛ぶ, which would mean 'fly the sky on two wings' , which would not be the correct translation.
To use a similar structure:
①二人の男が/ボールを/投げます。Two males / throw / a ball.
②男は/ボールを/二人で/投げます。The male(s) / throw / a ball / as two (together)
③男は/二人で/ボールを/なげます。The male(s) / as two (together) / throw / a ball.
④男は/ボールを/二人投げ/します。The male(s) / a ball / together-throw / do.
As you can see in sentence ④, the action has been changed from 'throwing a ball' to 'playing catch', where 'playing catch' is considered a noun-phrase. In this example the distinction is subtle, but the meaning is different and is more noticeable when discussing flying birds. Simply by adding a particle (compare sentence ④ to sentence ②) and of course correcting the conjugation, the meaning can change quite a bit.
*I don't know whether this is more helpful or confusing. Hopefully the former:)
I can't find any answers that accept "...鳥が二羽飛んでいます", but surely that's a standard way of expressing two birds flying?
Your (truncated) sentence looks fine to me. It might just be that they haven't added that grammatical structure or all of the relevant kanji to the accepted answer range.
If I want to separate the number from the birds, how do I do it in this sentence? Is this wrong?
Can you end this in とんでいる? I'm trying to understand how casual works vs formal. Also can you leave out を in this instance? (In casual speech)
Yes and yes. The casual form would be more appropriate for your in-group, aside from superiors in more formal situations.