What do you mean by "it doesn't work"? does it run but not return an answer, does it throw an error, or does it not run and returns your Maximize[...] expression?
It ran for me (but warned about convergence). This would be a problem in your equations.
Did you change my "p" s to formalP's?
I suggest removing everything from the Module[] for debugging so you can check each expression and then package it up in the Module.
Your other constraint looks like this:
And @@ Thread[Array[p, Length[t]] > 0] &&
And @@ Table[
a - \[Beta] (p[i] + p[i - 1]) - \[Alpha] p[1] > 0, {i, 2,
Length[t]}]
to get
p[1]>0&&p[2]>0&&p[3]>0&&p[4]>0&&p[5]>0&&10000-100 p[1]-10 (p[1]+p[2])>0&&10000-100 p[1]-10 (p[2]+p[3])>0&&10000-100 p[1]-10 (p[3]+p[4])>0&&10000-100 p[1]-10 (p[4]+p[5])>0
I ran this and it returned an answer:
Maximize[{f[\[FormalX], Array[\[FormalP], Length[t]]],
And @@ Thread[Array[\[FormalP], Length[t]] > 0] &&
And @@ Table[
a - \[Beta] (\[FormalP][i] + \[FormalP][
i - 1]) - \[Alpha] \[FormalP][1] > 0, {i, 2, 5}]},
Flatten[{\[FormalX], Array[\[FormalP], Length[t]]}]]
to get:
{1.66918*10^7, {\[FormalX] -> 96.3516, \[FormalP][1] ->
5.00841*10^-12, \[FormalP][2] -> 498.529, \[FormalP][3] ->
501.471, \[FormalP][4] -> 498.529, \[FormalP][5] -> 501.471}}