Algebraic demand curve in a perfectly competitive market for a firm I've had a few years of economics courses already but still there are some basic things in the field that I just can not wrap my head around... (let's say economics is not my favorite field of study)

The problem that I'm having is about an algebraic representation of a demand curve in a perfectly competitive market.

Say that there is a set of N suppliers (with |N| possible tending towards infinity, hence a perfectly competitive market; let's just assume free entrance to the market too), consider a supplier i. The market demand function in terms of the output of supplier i can now be written as:



Here what is in the curly brackets is just the total market output. Now here's my problem, if you take the derivative of this function wrt. q_i, then you find that this derivative equals beta. However, I've also heard that the derivative of market demand with respect to a firm's output, in a perfectly competitive environment, is 0; as in perfect competition, a firm cannot control the price through its output this effect is very very small because of the many other suppliers.

Where in my reasoning did I go wrong?
If we're considering the canonical case of one firm facing perfect competition, then we're faced with a demand curve (for each firm's goods) that's perfectly flat- regardless of how many units any given firm produces, consumers are willing to pay a certain market price $p$ and no more (all of this is just a restatement of what you've mentioned in the question, of course). 

What we can do is then consider how to have a model that incorporates this definition of perfect competition with your given definition of the demand facing firm $i$. As you point out, the derivative of the demand as you've defined it is $\beta$. (Again, all a restatement of what you've pointed out).

The next question to ask, then, is "what is $\beta$?" Effectively, it's the slope of the demand curve each firm faces. If we assume perfect competition, then we assume a flat demand curve, which leads us to conclude that $\beta=0$. I'd suggest that your reasoning didn't go wrong anywhere, just that the two threads need to be directly connected!