Good question. There are plenty of investors who think they can simply rely on intuition, and although luck is always present it is not enough to construct a proper portfolio.
First of all there are two basic types of portfolio management: Passive and Active.
The majority of abnormal gains are made with active portfolio management although passive managers are less likely to suffer loses.
Both types must be created with some kind of qualitative and quantitative research, but an active portfolio requires constant adjustments (Market Timing) to preserve the desired levels of risk and return.
The topic is extremely broad and every manager has his own preferred methods of quantitative analysis. I will try to list here some most common, in my opinion, ways of stock-picking and portfolio management.
Roy's Criterion:
The best portfolio is that with the lowest probability that the return will be below a specified level.
This is achieved by maximising the number of standard deviations between the return on the portfolio and minimum specified level:
Max k = (Rp-Rl)/Sp
Where (Rp) - return on portfolio, (Rl) - specified minimum return, (Sp) - standard deviation of portfolio return.
Kataoka's Criterion:
Maximise the minimum return (Rl) subject to constraint that the chance of a return below (Rl) is less than or equal to a specified value (a).
Maximise (Rl) Subject to Prob (Rp < Rl) =< a
For example, assume that the specified value is 20% - this will be met provided (Rl) is at least 0.84 standard deviations below (Rp). Therefore the best portfolio is the one that maximises (Rl) where:
Rl = Rp-0.84*Sp
Telser's Criterion:
Maximise expected return subject to the constraint that the chance of a return below the specified minimum is less than or equal to some specified minimum (a)
Maximise (Rp) subject to Prob (Rp < Rl) =< a
Assuming same data as previously:
Rl =< Rp-0.84*Sp and select the portfolio with highest expected return.
Security Selection
Now let's look at some methods of security selection. This is important when a manager believes some shares are mispriced.
The required return on security 'i' is given by:
Ri = Rf+(Rm-Rf)Bi
Where (Rf) - is a risk-free rate, (Rm) - return on the market, (Bi) - security's beta.
The difference between the required return and the actual return expected is known as the security's alpha (Ai).
Ai = Rai - Ri, where (Rai) is actual return on security 'i'.
Stock Picking
One way of stock-picking is to select portfolios of securities with positive alphas.
Alpha of a portfolio is simply the weighted average of the alphas of the securities in the portfolio.
Ap = {(n*Ai)
Where ({) is sigma (sorry for such weird typing, haven't figured out yet how to type proper-looking formulas), (n) - share of 'i'th security in portfolio.
So another way of stock-picking is ranking securities by their excess return to beta (ERB):
ERB = (Ri - Rf)/Bi
The greater the ERB the more desirable the security and the greater the proportion it will make up of the portfolio. Thus portfolios produced by this technique will have greater proportion of some securities than the market portfolio and lower proportions of other securities.
The number of securities depends on a cut-off rate (C*) for the ERB, defined so that all securities with ERB>C* are included in portfolio while if ERB
The cut-off rate for a portfolio containing the first 'j' securities is given by (i'm inserting an image cut from Word below):

Here comes the tricky part:
Basically what you do is first calculate ERB for each security, then calculate Cj for each security mix (gradually adding new securities one by one and recalculating Cj each time). Then you select an optimum portfolio by comparing Cj of each mix to ERB's of it's securities. Let me show you a simple example:
Say you have securities A,B,C and D
you calculated ERB's: ERB(a)=6, ERB(b)=6.5, ERB(c)=5, ERB(d)=4
also you calculated: C(a)=4.1, C(ab)=4.8, C(abc)=4.9, C(abcd)=4.5.
Then you check:
ERB(a),ERB(b),ERB(c) are greater than C(a), but C(a) only contains security A so C(a) is not an optimum mix.
ERB(a),ERB(b),ERB(c) are greater than C(ab), but C(ab) only contains securities A and B
ERB(a),ERB(b),ERB(c) are greater than C(abc), and C(abc) contains A B and C so it is an optimum.
ERB(d) is lower than C(abcd) so C(abcd) is not an optimum portfolio.
Finally the most important part:
Below is a formula to find the share of each security in the portfolio:

Here you simply plug in already obtained values for each security to find it's proportion in your portfolio.
I hope this somehow answers your question, however there is a lot more than this to consider if you decide to manage your portfolio yourself.
Some of the most important areas are:
- Market Timing
- Hedging
- Stocks vs Bonds
Good luck with your investments!
And remember, the safest portfolio is the one that replicates the Global Market.