According to the Kafka documentation:
The producer is responsible for choosing which message to assign to which partition within the topic.
Update: This answer was correct on 2014, but more current versions of Kafka can produce key/value pairs via the console producer. See the below answers
kafka-console-producer.sh doesn't support producing messages to a particular partition out of the box.
However it should be pretty straightforward to update the script to pass an extra parameter for partition Id and then handle it in a custom partitioner as described in the post by @Chiron in a modified version of kafka.tools.ConsoleProducer class.
Take a look at the source code at:
https://apache.googlesource.com/kafka/+/refs/heads/trunk/bin/kafka-console-producer.sh https://apache.googlesource.com/kafka/+/refs/heads/trunk/core/src/main/scala/kafka/tools/ConsoleProducer.scala